- Posts: 18
COMMUNITY FORUM
[SOLVED] tag same as category item
- Amir
-
Topic Author
- Offline
- New Member
Less
More
9 years 11 months ago #144113
by Amir
tag same as category item was created by Amir
Hi ,
How can i need change tag layout same as category item , when i copy code from category item file to tag file it's not working .
Best Regards,
Mike
How can i need change tag layout same as category item , when i copy code from category item file to tag file it's not working .
Best Regards,
Mike
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- User
Less
More
9 years 11 months ago #144117
by Krikor Boghossian
Replied by Krikor Boghossian on topic tag same as category item
You need to only change the css classes. Copying php code will produce fatal errors.
Please Log in or Create an account to join the conversation.
- Amir
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 18
9 years 11 months ago #144142
by Amir
Replied by Amir on topic tag same as category item
Dear Krikor ,
Thank you for your promptly reply ,
My issue is not css class i have problem with js file when i use js file in category item file it's ok but same as code use in tag file doesn't work !
Best Regards,
Mike
Thank you for your promptly reply ,
My issue is not css class i have problem with js file when i use js file in category item file it's ok but same as code use in tag file doesn't work !
Best Regards,
Mike
Please Log in or Create an account to join the conversation.
- Joe Campbell
-
- User
Less
More
9 years 11 months ago - 9 years 11 months ago #144144
by Joe Campbell
Replied by Joe Campbell on topic tag same as category item
Hello Amir,
There's two things you need to be mindful of when working with category vs tag override files:
1) Class name: K2 uses a prefix for each view type at the beginning of the class name: tagItemTitle vs. catItemTitle
2) How you render elements (title, extra fields, etc.): tag pages starts with $item-> while category starts with $this->
See highlighted examples below for a comparison...
TAG CODE ::: tag.php
<h2 class="tagItemTitle">
<?php echo $item->extraFields->NAME->value; ?>
<?php echo $item->title; ?>
CATEGORY CODE ::: category_item.php
<h2 class="catItemTitle">
<?php echo $this->item->extraFields->NAME->value; ?>
<?php echo $this->item->title; ?>
I hope this helps,
Joe Campbell
There's two things you need to be mindful of when working with category vs tag override files:
1) Class name: K2 uses a prefix for each view type at the beginning of the class name: tagItemTitle vs. catItemTitle
2) How you render elements (title, extra fields, etc.): tag pages starts with $item-> while category starts with $this->
See highlighted examples below for a comparison...
TAG CODE ::: tag.php
<h2 class="tagItemTitle">
<?php echo $item->extraFields->NAME->value; ?>
<?php echo $item->title; ?>
CATEGORY CODE ::: category_item.php
<h2 class="catItemTitle">
<?php echo $this->item->extraFields->NAME->value; ?>
<?php echo $this->item->title; ?>
I hope this helps,
Joe Campbell
Last edit: 9 years 11 months ago by Joe Campbell.
Please Log in or Create an account to join the conversation.
- Amir
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 18
9 years 11 months ago #144145
by Amir
Replied by Amir on topic tag same as category item
Hello Joseph ,
Your explanation was so perfect .
Kind Regards,
Amir
Your explanation was so perfect .
Kind Regards,
Amir
Please Log in or Create an account to join the conversation.