show only entries from current category..?

Discuss PivotX 2.0.x themes here, and view themes that are available for download.

show only entries from current category..?

Postby rabbeltje » Mon Apr 01, 2013 3:46 pm

I've been trying to figure this out but i can't seem to find the answer myself. Maybe it's reall y simple and i can't think of it because i have been out the coding-business for a while, but i'd appreciate any help!

On my site http://www.rabbeltje.nl i show one entry per page, and on the side there are pictures from other entries. Preferably, i'd like that to be entries from the same category. The way i achieved the current results is using a different subweblog on the page, in a sidebar (and the bonusfield-extensions to associate an image with each entry).

Code: Select all
      <div id="content">
            <div id="left">
               <div id="intro">
                  <h2>[[ title ]]</h2>
                <div class="gallery">
                  [[gallery popup="fancybox"]]
                  <a href='%imageurl%%filename%' class="fancybox" title="%title%" rel="gallery-%uid%" >
                  <img src="%pivotxurl%includes/timthumb.php?src=%filename%&w=106&h=80&zc=1" alt="%alttext%" />
                  </a>
                  [[/gallery]]
               </div>
               [[ introduction ]]
               [[ body ]]
            </div>
         </div>
         <div id="right">
            <div id="latest">
               <h2>Andere taarten</h2>
               <!-- begin of weblog 'random' -->
               [[ subweblog name="random" order="random"]][[ literal ]]
               <div class="random-entry">
                  <a href="[[ link hrefonly=1 ]]">
                  [[ if $entry.extrafields.foto ]]
                  [[ image file=$entry.extrafields.foto alt=$entry.extrafields.description class="latestfoto" ]]
                  [[ else ]]
                  <h3>[[title]]</h3>
                  [[ /if ]]</a>
               </div>
               [[ /literal ]][[ /subweblog ]]
               <!-- end of weblog 'random' -->
            </div>
               [[tagcloud]]
         </div>
      </div>


This is part of the code. So basically what i want it to do is only display entries in my 'random'-subweblog from the category that is in my intro-div. Is there any way i can do this..?

edit: look at one of the entry-pages, like http://www.rabbeltje.nl/?e=186 . The frontpage works just as it should ;))
User avatar
rabbeltje
 
Posts: 358
Joined: Mon Aug 25, 2008 11:54 am
Location: Neerbeek, The Netherlands

Re: show only entries from current category..?

Postby Harm10 » Mon Apr 01, 2013 4:43 pm

I haven't tested this but how about saving the first category of your entry and using that variable in the subweblog category parm?
Something like this:
Code: Select all
[[ assign var=savethecat value=$entry.category[0] ]]
<!-- begin of weblog 'random' -->
[[ subweblog name="random" order="random" category=$savethecat ]][[ literal ]] etc
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2010
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)

Re: show only entries from current category..?

Postby rabbeltje » Mon Apr 01, 2013 5:17 pm

fabulous! thanks a million!
User avatar
rabbeltje
 
Posts: 358
Joined: Mon Aug 25, 2008 11:54 am
Location: Neerbeek, The Netherlands

Re: show only entries from current category..?

Postby Harm10 » Mon Apr 01, 2013 7:00 pm

rabbeltje wrote:fabulous! thanks a million!
You are welcome!
Quality is in the detail of things............

Want to change or update your PivotX site? Mail or PM me!
I can also convert your site to a Wordpress site!
Harm10
Developer
 
Posts: 2010
Joined: Wed Jun 17, 2009 9:37 am
Location: Somewhere in The Netherlands (aka Holland)


Return to 2.x Themes

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron