10 years 4 months ago #155673
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- customize the display of items k2 of certain categories
customize the display of items k2 of certain categories
10 years 4 months ago #155733
First of all you should use overrides -> getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
In the category_item.php file you can perform a simple check like this:
Where you can echo some CSS class which differentiate the layout.
In the category_item.php file you can perform a simple check like this:
<?php if($item->categoryname == 'CATEGORY_NAME'):
#code here
endif; ?>Where you can echo some CSS class which differentiate the layout.
Topic Author
10 years 4 months ago #155754
Hi,
thank you for attention, I've followed the instructions cited in this connection and is the result :
www.aidepharmacien.ma/allergologie/antihistaminiques-h1
but what I do not understand is that I did call that 4 additional fields! why others are displayed ?
thank you for attention, I've followed the instructions cited in this connection and is the result :
www.aidepharmacien.ma/allergologie/antihistaminiques-h1
but what I do not understand is that I did call that 4 additional fields! why others are displayed ?
10 years 4 months ago #155760
These are the extrafields. You can hide them by selecting 'Hide' in the category's settings.
Topic Author
10 years 4 months ago #155767
Hi
You can hide them by selecting 'Hide' in the category's settings.
I made it but this is the result :
the option hides all the additional fields :(
I think we have something that deleted the file category_item.php !
You can hide them by selecting 'Hide' in the category's settings.
I made it but this is the result :
the option hides all the additional fields :(
I think we have something that deleted the file category_item.php !
Edited 10 years 4 months ago by Alaabouch
10 years 4 months ago #155810
You should move the extrafields block next to the title and apply float left to these classes.
Topic Author
10 years 4 months ago #155829
Hi,
can you give me a hand please. I remove the extra fields to the title but I know not how to apply float right to te class ?
can you give me a hand please. I remove the extra fields to the title but I know not how to apply float right to te class ?
Topic Author
10 years 4 months ago #155856
Hi,
Here, I just do it! but it's ugly as design. is it possible to integrate them in a table ?
Here, I just do it! but it's ugly as design. is it possible to integrate them in a table ?
Topic Author
10 years 4 months ago #155857
Hi,
Here, I just do it! but it's ugly as design. is it possible to integrate them in a table ?
www.aidepharmacien.ma/antalgiques/antalgiques-non-opioides
Here, I just do it! but it's ugly as design. is it possible to integrate them in a table ?
www.aidepharmacien.ma/antalgiques/antalgiques-non-opioides
Topic Author
10 years 4 months ago #155867
Hi,
I have made the change, but I would incorporate the content in a table. is it possible ?
I have made the change, but I would incorporate the content in a table. is it possible ?
10 years 4 months ago #155868
You can do this, you will have to override the category_item.php file however - getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
Topic Author
10 years 4 months ago #156071
Hi,
in this code
/* extrafields columns */
.extrafieldscolumns ul { width: 100%; margin:0;padding:0;/* CSS Reset */ max-width: 1000px; /* restrict the width */ margin: 0 40px; /* center it */}.extrafieldscolumns li { width: 20%; float:center; /* IMPORTANT */ list-style-type: none; display:inline; /* IMPORTANT */}
/* END extrafields columns */
div.catItemView.groupLeading{float:left;}
div.extrafieldscolumns{float: left;}
I don't know how do I adjust this code for additional fields align vertically ?
in this code
/* extrafields columns */
.extrafieldscolumns ul { width: 100%; margin:0;padding:0;/* CSS Reset */ max-width: 1000px; /* restrict the width */ margin: 0 40px; /* center it */}.extrafieldscolumns li { width: 20%; float:center; /* IMPORTANT */ list-style-type: none; display:inline; /* IMPORTANT */}
/* END extrafields columns */
div.catItemView.groupLeading{float:left;}
div.extrafieldscolumns{float: left;}
I don't know how do I adjust this code for additional fields align vertically ?
Edited 10 years 4 months ago by Alaabouch
Topic Author
10 years 4 months ago #156072
Hi,
in this code
/* extrafields columns */
.extrafieldscolumns ul { width: 100%; margin:0;padding:0;/* CSS Reset */ max-width: 1000px; /* restrict the width */ margin: 0 40px; /* center it */}.extrafieldscolumns li { width: 20%; float:center; /* IMPORTANT */ list-style-type: none; display:inline; /* IMPORTANT */}
/* END extrafields columns */
div.catItemView.groupLeading{float:left;}
div.extrafieldscolumns{float: left;}
I don't know how do I adjust this code for additional fields align vertically ?
in this code
/* extrafields columns */
.extrafieldscolumns ul { width: 100%; margin:0;padding:0;/* CSS Reset */ max-width: 1000px; /* restrict the width */ margin: 0 40px; /* center it */}.extrafieldscolumns li { width: 20%; float:center; /* IMPORTANT */ list-style-type: none; display:inline; /* IMPORTANT */}
/* END extrafields columns */
div.catItemView.groupLeading{float:left;}
div.extrafieldscolumns{float: left;}
I don't know how do I adjust this code for additional fields align vertically ?
Topic Author
10 years 4 months ago #156099
Hi,
there was someone who had me help solve this problem partially. I replace the preceding code with this code in the file override.css
.itemContainer {
display: block;
}
.catItemView {
width: 30%;
}
.extrafieldscolumns ul {
margin: 0;
max-width: none;
padding: 0;
width: 100%;
}
.extrafieldscolumns li {
display: inline-block;
width: 20%;
text-align: right;
}
.extrafieldscolumns li:first-child {
width: 20%;
text-align: left;
}
.extrafieldscolumns li:nth-child(2) {
width: 30%;
}
.extrafieldscolumns li:nth-child(3) {
width: 20%;
}
.extrafieldscolumns li:nth-child(4) {
width: 10%;
}
but the change has been applied in all pages :(
there was someone who had me help solve this problem partially. I replace the preceding code with this code in the file override.css
.itemContainer {
display: block;
}
.catItemView {
width: 30%;
}
.extrafieldscolumns ul {
margin: 0;
max-width: none;
padding: 0;
width: 100%;
}
.extrafieldscolumns li {
display: inline-block;
width: 20%;
text-align: right;
}
.extrafieldscolumns li:first-child {
width: 20%;
text-align: left;
}
.extrafieldscolumns li:nth-child(2) {
width: 30%;
}
.extrafieldscolumns li:nth-child(3) {
width: 20%;
}
.extrafieldscolumns li:nth-child(4) {
width: 10%;
}
but the change has been applied in all pages :(
Edited 10 years 4 months ago by Alaabouch
10 years 4 months ago #156129
FYI float:center; is not supported (sadly).
Now, you can create a K2 sub-template and add a class to the wrapper which is specific to that view.
Then your CSS should look like:
More info can be found here: www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating
Now, you can create a K2 sub-template and add a class to the wrapper which is specific to that view.
Then your CSS should look like:
YourWrapperClass .itemContainer {
display: block;
}
YourWrapperClass .catItemView {
width: 30%;
}
.YourWrapperClass .extrafieldscolumns ul
... More info can be found here: www.joomlaworks.net/blog/item/194-k2-inheritance-sub-templating
Log in or create an account to reply.

