Offsetting categories
Posted: 15 August 2007 09:53 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  03-07-2006

Is it possible to offset a list of categories using the categories tag? I notice that its not on the docs.

This is what I have

{exp:weblog:categories weblog="weblogname" show_empty="no" style="linear"}

<li><a href="{path="stockists/listing/{segment_3}/C{category_id}}">{category_name}</a></li>

{/exp:weblog:categories}

Which produces this page

But I need the list in columns (they are listed from left to right at the moment by floating then left in my CSS), the only way I can think to do it is to do 4 columns and use offset and 4 lots of categories tags.

Any suggestions will be welcomed

Thanks

 Signature 

· Confused… but happy ·

Profile
 
 
Posted: 29 August 2007 03:56 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  03-07-2006

Any ideas people?? Could this be achieved with the query module? I’ve seen similar things with the query module but I’m unsure of how to use it!

 Signature 

· Confused… but happy ·

Profile
 
 
Posted: 06 September 2007 03:16 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  03-07-2006

Can anyone pleeeease answer yes or no to this please?! I need to find a way to make this work

Many thanks

 Signature 

· Confused… but happy ·

Profile
 
 
Posted: 14 September 2007 06:54 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
RankRankRank
Total Posts:  531
Joined  10-22-2006
Mikee Bee - 15 August 2007 09:53 AM

the only way I can think to do it is to do 4 columns and use offset and 4 lots of categories tags.

If you were willing to do it like this (manually using as many category tags as needed and adjust the offsets), writing a plugin for it would take only a few minutes.

Profile
 
 
Posted: 14 September 2007 07:40 AM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5582
Joined  04-15-2006

Hiya,

Sorry only just noticed this post so that’s why I haven’t replied yet grin

I think (could be wrong though) that you could maybe get this to work by using PHP in conjunction with the categories tag.
What you would do is set a $count variable to 0 before the categories tag spits anything out. You would then spit out each category into a DIV (far left column) and let this happen for as many that you want in a column each time incrementing the PHP $count variable. Once you reach the count that you wish to start the next DIV at you would start a new DIV and carry on as before and so on and so forth.

This (with a little bit of clever PHP) could also be totally dynamic so that you could first of all find out how many towns there are altogether, divide this by three for your columns (or however many columns you would like - being dynamic this could even be changed on the fly!). You would then have a max width that the columns are allowed to take up in the design and then you could dynamically create the DIV columns to these specifications. A little bit of work but it would mean that any time you add new towns to the list then the page would automatically re-design itself as it were to the correct format every time!!!

Now I could be completely wrong on all of this and I gladly welcome people to tell me that I am as I have been in the past… aren’t we all at some time!! :-D but I am almost 99% sure it should be able to be done like this.

Also as silenz has said a plugin could probably be created to handle this for you also but I personally wouldn’t know where to start on that myself.

Hope this helps a bit?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 14 September 2007 10:10 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
RankRankRank
Total Posts:  531
Joined  10-22-2006

Well, I could use this for another project so I did a quick shot.

The plugin can be used in the way Mikee described in the first post.

Alternatively it can also automatically create a specified number of <DIV>-blocks.

Instructions are included on the plugins-page in ControlPanel.

I’m a bit in a hurry right now and quite busy on the weekend so I cannot guarantee to answer any questions or iron out any bugs before next week.

pi.cat_offset.php

Profile
 
 
Posted: 14 September 2007 12:03 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  03-07-2006

Good god silenz (and Mark)! Thankyou so much, I’ll give this little betty a whirl and report back!!

 Signature 

· Confused… but happy ·

Profile
 
 
Posted: 18 September 2007 04:45 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  03-07-2006

Hi Silenz, using the plugin and its working sweet. Only problem I’ve found so far is that its outputting an extra column than specified but only on one of the pages I use it on!!?

<ul id="regionlist">

{exp:cat_offset:auto delimiter="</li>" columns="5" class="catcol"}
{exp
:weblog:categories weblog="stockists_{segment_3}" show_empty="no" style="linear"}

<li><a href="{path="stockists/listing/{segment_3}/C{category_id}}">{category_name}</a></li>

{/exp:weblog:categories}
{/exp:cat_offset:auto}

</ul>

All the pages run through one template it just switches the categories based on the url segment

This page and this page are fine but this page is getting an extra column to accommodate the last category ’Turkey’ as you can see from the source.

Any ideas?

 Signature 

· Confused… but happy ·

Profile
 
 
Posted: 18 September 2007 05:00 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
RankRankRank
Total Posts:  531
Joined  10-22-2006
Mikee Bee - 18 September 2007 04:45 AM

Any ideas?

Yes. I made a rounding mistake red face
But that is what beta-testers are for, aren’t they?  tongue wink

If you re-download the plugin it ought to be fixed.

Profile
 
 
Posted: 18 September 2007 05:03 AM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5582
Joined  04-15-2006

Hi there,

Just saw this post had been updated and was wondering if I could download the plug-in also? I noticed that a second ago it was on the forum but when I clicked on it all I got was a blank page come up and now after refreshing the page the download link is no longer there?

Just wondering if I could get a look though?

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 18 September 2007 05:57 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
RankRankRank
Total Posts:  531
Joined  10-22-2006

Seems something went wrong with re-attaching the file.
It’s back now.

Profile
 
 
Posted: 18 September 2007 05:58 AM   [ Ignore ]   [ # 11 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5582
Joined  04-15-2006

Aha,

It’s back again now. Don’t know what was going on there though!

Thanks.

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 18 September 2007 05:58 AM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5582
Joined  04-15-2006

We wrote at the same time!! grin

Thanks though. Will take a look at this as it could come in handy for a site that I maintain.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (15)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 18 September 2007 06:01 AM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  315
Joined  03-07-2006

Magic! Thanks again

 Signature 

· Confused… but happy ·

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62451 Total Logged-in Users: 33
Total Topics: 76735 Total Anonymous Users: 21
Total Replies: 414519 Total Guests: 610
Total Posts: 491254    
Members ( View Memberlist )