Individual Blogroll for category

Get help with installation and running PivotX 2.0.x here. Please do not post Extension or Theme related questions here.

Re: Individual Blogroll for category

Postby xzjia » Sun Oct 25, 2009 2:34 pm

Dude from what I see you got the if / else statement wrong.

You have to always close an if statement off with [[/if]], [[/else]] does not exist.

If you typed in Google "smarty if", then you would have found: http://www.smarty.net/manual/en/languag ... ion.if.php

This is some super basic concepts here that even non-coders picks up (that's why they're in Smarty). You really need to read up about the basics, or have a friend teach you the ropes if you want to mess with the templates yourself.

Also, nobody's going to dig into a June post to see if it's answered, bump it again before throwing accusations around.
xzjia
 
Posts: 110
Joined: Tue Dec 11, 2007 6:26 pm

Re: Individual Blogroll for category

Postby Schop » Sun Oct 25, 2009 3:57 pm

Well, there is functionality for 'if..then..else..' statements:

Code: Select all
[[if]] x is true
do this
[[elseif]] y is true
 do that
[[else]]
do something different
[[/if]]


would be the syntax. You will have to experiment a little bit to accomplish what you want exactl of course. It looks like you got some help in the right direction. If you needed more help, you should have read the documentation or explained better what you wanted, instead of bumping it without trying something yourself.
User avatar
Schop
Contributor
 
Posts: 481
Joined: Mon Apr 21, 2008 1:47 pm
Location: Hudson, Ohio

Re: Individual Blogroll for category

Postby hansfn » Sun Oct 25, 2009 9:12 pm

No.

I guess the correct code is:

Code: Select all
       <h3>[[t]]Links[[/t]]</h3>
       [[ if $entry.category[0]=="internal_news" ]]
            [[ include file="yourthemename/_sub_link_list_internal_news.html" ]]
       [[ elseif $entry.category[0]=="external_news" ]]
            [[ include file="yourthemename/_sub_link_list_external_news.html" ]]
       [[else]]
           [[link_list]]
       [[/fi]]
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Individual Blogroll for category

Postby Unmerciful » Mon Oct 26, 2009 12:11 pm

hansfn thank you very much for your help
Now the error is not issued, but in any category included [[link_list]]
I think that the error in the
[[ if $entry.category[0]=="internal_news" ]]
Unmerciful
 
Posts: 33
Joined: Mon Mar 09, 2009 11:14 am

Re: Individual Blogroll for category

Postby hansfn » Mon Oct 26, 2009 2:02 pm

As long as you don't tell what your categories are named (and exactly what template code you use), I can't help you. A link to your site would also have helped a lot.
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Individual Blogroll for category

Postby Unmerciful » Mon Oct 26, 2009 4:19 pm

blog:

http://mediafon.biz/index.php

code:

<h3>[[t]]Links[[/t]]</h3>
[[ if $entry.category[0]=="test-2" ]]
[[ include file="skinny/_sub_link_list_test-2.html" ]]
[[ elseif $entry.category[0]=="test1" ]]
[[ include file="skinny/_sub_link_list_test1.html" ]]
[[ elseif $entry.category[0]=="test-3" ]]
[[ include file="skinny/_sub_link_list_test-3.html" ]]
[[else]]
[[link_list]]
[[/if]]
Unmerciful
 
Posts: 33
Joined: Mon Mar 09, 2009 11:14 am

Re: Individual Blogroll for category

Postby hansfn » Mon Oct 26, 2009 5:18 pm

But it works. Compare the links in the right menu on
http://mediafon.biz/entry/5/
http://mediafon.biz/entry/4/
http://mediafon.biz/entry/3/

No, it doesn't work on http://mediafon.biz/category/test1 etc. Do you understand why?
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Individual Blogroll for category

Postby Unmerciful » Mon Oct 26, 2009 7:52 pm

I think the problem here:
$entry.category[0]==
Unmerciful
 
Posts: 33
Joined: Mon Mar 09, 2009 11:14 am

Re: Individual Blogroll for category

Postby hansfn » Thu Oct 29, 2009 2:03 pm

Yes, because on a category page, $entry isn't defined - there are many entries to choose from ... Try using $modifier.category instead of $entry.category[0] and it works on category pages. Conclusion: You need to check both.

PS! If you need to do advanced stuff like this you need to learn Smarty ...
hansfn
Developer
 
Posts: 3072
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Previous

Return to 2.x Support Forum

Who is online

Users browsing this forum: No registered users and 2 guests