-
AuthorPosts
-
October 3, 2012 at 6:13 am #468930
Hi again arucardx,
Sorry I thought I had everything fixed perfectly, but there is just one last hiccup…
On my front page I have had K2 items that are in a category not included in the code you gave me. I want these Items to open normally into the item contents, and it does if I click “read more” but I think adding the code for the Title and Image before, has changed the qualities of these items too… The image and title of these k2 items now take me to the category, rather than the k2 item content.
Any ideas?
Thanks 🙂
October 3, 2012 at 7:59 am #468947P.s The items that I have on my Front page that Id like to open into their normal k2 item content, are tagged “Front Page” and are also in a category “Front Page”
Do you think I should put an IF Statement for the category “front page” in the coding I put in before for the Title and image link?
Thanks
Katiearucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
October 3, 2012 at 12:04 pm #468990?
5 mins later
??
Still ???October 3, 2012 at 12:13 pm #468992Heheh me too…just readin your response had me that way for awhile!!
Is my question abit confusing?
arucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
October 3, 2012 at 2:28 pm #469010Sorry, had a long day and the discovery of more bugs on my website killed my annoyed mind just now.
I have a question to ask. Why are you displaying items on the front page with the tag “Front Page” anyway? On K2 you can select multiple categories to display on the homepage by holding shift + click or ctrl + click in the menu item.
As for the items that you would like to open their item page instead of redirecting to category page, you don’t need to add their category name to the IF statement since the IF statement is there for the category redirect if the name matches. If the category name doesn’t match the IF statement then it will just open the item page.
October 4, 2012 at 5:20 am #469089Wow… Ive been so stupid! At first I didnt do a category page for my Homepage because everything showed up and I only wanted certain items from a category to show….But now youv shown me how I can hide/show only featured Items, it ok!! Ive learnt big time!!!!
Ok will it be easier now, to take that code you made for me for my tag file, and transfer it to another file… my home template is now ja wall, so would the code now go in ja_wall default file?
Also regarding the items that I do want to open into their actual item page; well at the moment for some reason the title and image are takin me to the category… not certain why…
Hope youv had a better day today….jeez, does building these sites ever get easier….without a new bug to figure out! Im just glad I have some help for mine 🙂
Cheers
KatieOctober 4, 2012 at 6:36 am #469093Hi,
So Ive reverted my homepage back to a K2 Category page now, with a number of categories highlighted and its working great if I show my features only
Then I replaced the code that you created in the Showcase Tag file, with the original coding…So everything is back to normal now.
So, to start again, I want to make some items on the Front page open into a category wall rather than the actual K2 item page…
So Ive taken the code you made me before; below[PHP]<?php if ($item->params->get(‘tagItemReadMore’)): ?>
<?php if ($item->category->name == ‘Frasier Props’ || $item->category->name == ‘Friends Props’): ?>
<p class=”readmore”>
<a href=”<?php echo $item->category->link; ?>”><?php echo JText::_(‘K2_READ_MORE’); ?></a>
</p>
<?php else: ?>
<p class=”readmore”>
<a class=”item-link” href=”<?php echo $item->link; ?>”><?php echo JText::_(‘K2_READ_MORE’); ?></a>
</p>
<?php endif; ?>
<?php endif; ?>[/PHP]Then Ive gone to Ja_wall => category_item.php and replaced it over this code
[PHP] <?php if ($this->item->params->get(‘catItemReadMore’)): ?>
<p class=”readmore”>
<a class=”item-link” href=”<?php echo $this->item->link; ?>”>
<?php echo JText::_(‘K2_WALL_READ_MORE’); ?>
</a>
</p>
<?php endif; ?>[/PHP]Then just replaced the tagItemReadMore with catItemReadMore
But unfortunately I get a funky page…no error but just a strange layout with no template at all..
arucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
October 4, 2012 at 6:59 am #469097Hmm… of course it will become funky if you just copy the paste the code over. The reference for category_item.php and tag.php are completely different so you will need to redo the code.
Btw, I see in your previous code, your IF statement is very long. If you have alot of categories that you want to redirect to category page, but only a few category that will point to their article page, then you should reverse the code and check those few category names in the IF statement instead. That way your server don’t have to check so thru many category names.
1 user says Thank You to arucardx for this useful post
October 4, 2012 at 7:27 am #469107Oh thats ok Ive actually decided to put all those (many) particular categories in another page so its ok…but I still have a few 1-3 categories Id like to have this code on the front page.
Would you mind if you have time, coming up with a code for the category_item.php file? Id also like to alter the Title and Image like before.
Though if I can open the other K2 items (not listed in If Statement) in the normal K2 page that would be great. For some reason before it the title and Image were going to the category
arucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
October 4, 2012 at 8:55 am #469115Hmm.. was doing the code halfway and realize I could simplified the coding, but weren’t sure if you are using pop up preview so I left it as it is.
For Image, find this
[PHP] <?php if($this->item->params->get(‘catItemImage’) && !empty($this->item->image)): ?>
<!– Item Image–>
<div class=”item-image”>
<a class=”item-link” href=”<?php echo $this->item->link; ?>” title=”<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>”>
<img src=”<?php echo $this->item->image; ?>” alt=”<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>” />
<span>Â </span>
</a>
</div>
<!– //Item Image–>
<?php endif; ?>[/PHP]Replace with this block
[PHP] <?php if($this->item->params->get(‘catItemImage’) && !empty($this->item->image)): ?>
<!– Item Image–>
<?php if ($item->category->name == ‘Frasier Props’ || $item->category->name == ‘Friends Props’): ?>
<div class=”item-image”>
<a href=”<?php echo $this->category->link; ?>” title=”<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>”>
<img src=”<?php echo $this->item->image; ?>” alt=”<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>” />
<span>Â </span>
</a>
</div>
<?php else: ?>
<div class=”item-image”>
<a class=”item-link” href=”<?php echo $this->item->link; ?>” title=”<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>”>
<img src=”<?php echo $this->item->image; ?>” alt=”<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>” />
<span>Â </span>
</a>
</div>
<?php endif; ?>
<!– //Item Image–>
<?php endif; ?>[/PHP]For title, find this
[PHP] <?php if($this->item->params->get(‘catItemTitle’)): ?>
<h2>
<?php if ($this->item->params->get(‘catItemTitleLinked’)): ?>
<a class=”item-link” href=”<?php echo $this->item->link; ?>”>
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?></h2>
<?php endif; ?>[/PHP]Replace with
[PHP] <?php if($this->item->params->get(‘catItemTitle’)): ?>
<?php if ($item->category->name == ‘Frasier Props’ || $item->category->name == ‘Friends Props’): ?>
<h2>
<?php if ($this->item->params->get(‘catItemTitleLinked’)): ?>
<a href=”<?php echo $this->category->link;; ?>”>
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>
</h2>
<?php else: ?>
<h2>
<?php if ($this->item->params->get(‘catItemTitleLinked’)): ?>
<a class=”item-link” href=”<?php echo $this->item->link; ?>”>
<?php echo $this->item->title; ?>
</a>
<?php else: ?>
<?php echo $this->item->title; ?>
<?php endif; ?>
</h2>
<?php endif; ?>
<?php endif; ?>[/PHP]For Read More, find this.
[PHP] <?php if ($this->item->params->get(‘catItemReadMore’)): ?>
<p class=”readmore”>
<a class=”item-link” href=”<?php echo $this->item->link; ?>”>
<?php echo JText::_(‘K2_WALL_READ_MORE’); ?>
</a>
</p>
<?php endif; ?>[/PHP]Replace with
[PHP] <?php if ($this->item->params->get(‘catItemReadMore’)): ?>
<?php if ($item->category->name == ‘Frasier Props’ || $item->category->name == ‘Friends Props’): ?>
<p class=”readmore”>
<a href=”<?php echo $this->category->link; ?>”>
<?php echo JText::_(‘K2_WALL_READ_MORE’); ?>
</a>
</p>
<?php else: ?>
<p class=”readmore”>
<a class=”item-link” href=”<?php echo $this->item->link; ?>”>
<?php echo JText::_(‘K2_WALL_READ_MORE’); ?>
</a>
</p>
<?php endif; ?>
<?php endif; ?> [/PHP]I didn’t test the code, but I don’t think there should be any errors.
1 user says Thank You to arucardx for this useful post
October 4, 2012 at 9:47 am #469122Sorry arucardx, No luck….
I double checked my Home page settings and on the right side under “Layout options for multiple category selection” the template is Ja_wall…
And the file that I altered was com_k2 => Ja_wall=>category_item.php
nothing seems to have changed so far
Also to answer your question about popup preview…yeh I dont use that 🙂
Thanks
arucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
October 4, 2012 at 10:13 am #469124Sry made a mistake in the code, causing the IF statement to fail.
Change this
[PHP]<?php if ($item->category->name == ‘Frasier Props’ || $item->category->name == ‘Friends Props’): ?> [/PHP]
To
[PHP]<?php if ($this->item->category->name == ‘Frasier Props’ || $this->item->category->name == ‘Friends Props’): ?> [/PHP]That should work now. Remember to made that change to image, title and read more.
October 4, 2012 at 10:33 am #469129Ohh well now it doesnt open in the k2 page but rather the home page that it is sitting on already.
Trying to think if its a setting I have on this item…
arucardx Friendarucardx
- Join date:
- July 2010
- Posts:
- 346
- Downloads:
- 0
- Uploads:
- 10
- Thanks:
- 21
- Thanked:
- 138 times in 104 posts
October 4, 2012 at 10:50 am #469130Replace
[PHP]$this->category->link[/PHP]
With
[PHP]$this->item->category->link[/PHP]Also in the code for the title, there’s a line with 2 ;; remove one ;
October 4, 2012 at 11:07 am #469131GOT IT!!!! Love it when it works!
Thats fantastic thanks so much 🙂
You can totally ignore this if you like, cause youve helped so much already but I just have another question regarding this coding;
I have actually kept the code you gave earlier in the tag.php in the showcase File because I am using this function there too now on another page…
But Im still havin that problem where the k2 Items that are in a category not mentioned in the If Statement; are actually going to the category, rather then to their normal k2 page. This is only on the Title and Image though..
Have a break if you like, but anytime you can spare for this prob that would be great!
-
AuthorPosts
This topic contains 61 replies, has 2 voices, and was last updated by arucardx 12 years, 1 month ago.
We moved to new unified forum. Please post all new support queries in our New Forum