Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-27 17:05:25

smombartz
New Member
Registered: 2009-02-27
Posts: 4

Contextual Sidebar Articles

I’m trying to change the content of the sidebar in relation to whats displayed in the main text window.

so for example when viewing the home article the sidebar shows all articles from the section news. thats working.

my problem now is that for the article advantages i would like to display a specific article (for example advantages-links) from the section sidebar.

any ideas?

here is the site: http://il.mombartz.com

and the current code:

<!-- SIDEBAR CONTENT -->
     	<div id="rightdiv">

<!-- NEWS, ONLY ON HOME -->        

            <txp:if_article_section name="content"><txp:if_article_id id="2">
           	<txp:article_custom section="news">
                <span class="newstitle"><txp:title /></span>
                <span class="newsdate"><txp:posted format="%B %Y" /></span>
                <span class="newsbody"><txp:body /></span>
            </txp:article_custom>            
            </txp:if_article_id></txp:if_article_section>

<!-- IMAGE -->        
                <txp:if_article_category name="SidebarImage" number="1">
                <txp:article section="sidebar">
                    <txp:article_image thumbnail="0" align="center" />
                </txp:article>
                </txp:if_article_category>
<!-- FILES -->
                <txp:if_article_section name="content"><txp:if_article_category name="SidebarLinks" number="1">
                <txp:article section="sidebar">
                    <span class="newstitle"><txp:title /></span>
                    <span class="newsbody"><txp:body /></span>
                </txp:article>
            	</txp:if_article_category></txp:if_article_section>

     	</div>

Offline

#2 2009-02-27 18:06:21

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Contextual Sidebar Articles

Does the related articles tag help? I think it links articles by category.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-02-27 18:21:15

smombartz
New Member
Registered: 2009-02-27
Posts: 4

Re: Contextual Sidebar Articles

almost but not quite since im trying to display another article and not a list. and ill have to be able to define the article to be displayed somewhere. maybe in the custom field?

Offline

#4 2009-02-28 00:05:25

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Contextual Sidebar Articles

You can use a custom field and put the id of the article you want to display in the sidebar there. Code for the sidebar something like this:

<txp:if_individual_article>
<txp:if_custom_field name="name-of-your-custom-field">
<txp:article_custom id='<txp:custom_field name="name-of-your-custom-field" />' />
</txp:if_custom_field>
</txp:if_individual_article>

Offline

#5 2009-03-02 22:24:48

smombartz
New Member
Registered: 2009-02-27
Posts: 4

Re: Contextual Sidebar Articles

hi Els,

thank for your reply. the tag within the tag doesnt seem to work. i didnt know that you could add a tag within a tag. or is there a way to get it to work?

cheers,
Sascha

Offline

#6 2009-03-02 22:27:48

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Contextual Sidebar Articles

It’s only possible since 4.0.7. If you are using 4.0.7 or later, are you sure you got the (single!) quotes right?

Offline

#7 2009-03-02 22:31:26

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Contextual Sidebar Articles

Tag nesting was added in 4.0.7


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#8 2009-03-02 22:52:40

smombartz
New Member
Registered: 2009-02-27
Posts: 4

Re: Contextual Sidebar Articles

ok my fault. forgot to add the txp:body etc tags… still learning.
thanks folks!!

Offline

Board footer

Powered by FluxBB