Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-03-21 00:25:23

bluesmiley
Member
Registered: 2006-03-21
Posts: 16
Website

home page with links from multiple sections

I’ve been searching for a way to do this for hours and have had no luck.

I want to create a home page with links from multiple sections, but I want each section to be clearly separated. In addition, I want a certain style on the list.

Here’s the format I’m looking to achieve

Section 1
article 1 link || article 2 link || article 3 link

Section 2
article 1 link || article 2 link || article 3 link

Here’s my site with only one section (Meandering Ramblings) on display, although it’s currently listing out all recent articles, no matter what section. http://www.slowlyfadingaway.com

I’m avoding categories for this, because I might use different categories within sections. It seems like this would be dead simple given how smart Textpattern is, but I’ve yet to figure out a simple way to achieve this. I’m guessing forms would be involved, but I’d appreciate any help on this issue.

Last edited by bluesmiley (2006-03-21 00:27:45)

Offline

#2 2006-03-21 03:07:28

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: home page with links from multiple sections

Did you ever look into TextBook expecially the tag examples ?
see article:custom

Offline

#3 2006-03-23 14:24:24

bluesmiley
Member
Registered: 2006-03-21
Posts: 16
Website

Re: home page with links from multiple sections

Alexandra, I’ve pretty much exhausted every resource I can think of to figure out this problem. You’ll see what I managed to do using forms and custom_article here:
www.myhomelesspage.com

So I’m able to print out links from two different sections, but I’m trying to style the lists in CSS and failing miserably. But with recent_articles, there’s a handy dandy “wraptag” attribute that takes care of that for me.

Oh well…I may have to resort to categories, but that will definitely limit some of the things I want to do with my site. Incidentally, this would all be simple to overcome if I just wanted the links to output in a standard list format, but CSS doesn’t handle the format of
link 1 || link 2 || link 3
well at all if the links have to wrap in a DIV.

And I’d really love to see more control of multiple section output on one page in future versions of textpattern. It seems like it should be simple to allow a feature like

txp:recent_articles section=“about”

I digress!

Offline

#4 2006-03-23 14:59:59

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: home page with links from multiple sections

You can place wraptags manually by putting <code><ul></ul></code> tags around the article_custom tag and placing <code><li></li></code> tags around the links in your form.

Last edited by thebombsite (2006-03-23 15:00:39)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2006-03-23 16:05:54

bluesmiley
Member
Registered: 2006-03-21
Posts: 16
Website

Re: home page with links from multiple sections

Bomb, I actually am doing the manual wrap using UL and LI tags…so that’s not the problem so much as my inability to reproduce the break attribute for recent_articles.

Here’s the code that formats properly as long as I’m not worried about sections:
txp:recent_articles wraptag=“ul” break=” ||”

That will generate something like this once I style the list properly:
link 1 || link 2 || link 3 || link 4
which is exactly the format I want for lists of links.

The problem is I can’t do this exactly with article_custom. I can emulate the wraptag fine with the technique you mention, but getting the “||” break between each list item has baffled me. I’m trying to accomplish this with CSS and am failing miserably. You’ll see my CSS styling fiasco at www.myhomelesspage.com.

Is there a textpattern tag that can be used with article_custom that will help me do this? I haven’t found anything.

Last edited by bluesmiley (2006-03-23 16:09:04)

Offline

#6 2006-03-23 16:27:22

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: home page with links from multiple sections

Hi bluesmiley, welcome!

First, break attribute is not to put anything you want like “||”. If you are using “ul” as wraptag, then you should use “li” as break.

Second, yes, you can use <txp:article_custom /> to generate what you want, and do it with semantically correct mark-up.

You can do something like this:
<code>
<ul>
<li><txp:section name=“section1” title=“1” link=“1” />
<ul>
<txp:article_custom form=“list” section=“section1” />
</ul>
</li>
<li><txp:section name=“section2” title=“1” link=“1” />
<ul>
<txp:article_custom form=“list” section=“section2” />
</ul>
</li>
</ul></code>
Then, create an article form, name it “list”, with this inside:

<code><li><txp:permlink><txp:title /></txp:permlink> || </li></code>

There you have your “||”

Of course, you will need to style the generated unordered list via CSS with “display:inline;” or “float:left”.
But that’s not something with teach here….

Last edited by maniqui (2006-03-23 16:28:07)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#7 2006-03-23 16:41:05

bluesmiley
Member
Registered: 2006-03-21
Posts: 16
Website

Re: home page with links from multiple sections

Thanks for the quick reply, Maniqui!
I had actually tried an approach similar to yours, but where it’s problematic is that it puts a “||” after the last list item, like this:

link 1 || link 2 || link 3 || link 4 ||

My preference is to use the pipes as a divider, and not have one awkwardly tacked on at the end like that. I may have been improperly using the “break” attribute by putting ‘break=”||”’, but it perfectly achieved what I was looking for!

Oh well, what I’m trying to do might just be a limitation of CSS more than anything. I know how to get this to work in CSS, but it only works if the links dont wrap, which is inevitable with this design.

Thanks for the help though. I guess I’ll try a different approach.

Offline

#8 2006-03-23 17:09:01

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: home page with links from multiple sections

Dont give up too quickly, bluesmiley!
TXP is about… magic! (?)

You can avoid that || at the end of your list…

Then, create an article form, name it “list”, with this inside: <code><li><txp:permlink><txp:title /></txp:permlink> || </li></code>

Keep the idea.
But apply this changes

<code><li><txp:if_last_article><txp:permlink><txp:title /></txp:permlink><txp:else /><txp:permlink><txp:title /></txp:permlink> || </txp:if_last_article></li></code>

Or what is exactly the same but with less code.

<code><li><txp:permlink><txp:title /></txp:permlink><txp:if_last_article><txp:else />||</txp:if_last_article></li></code>

More info about txp:if_last_article

edit: bc to bq, and other typo errors

Last edited by maniqui (2006-03-23 17:15:05)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#9 2006-03-23 18:31:32

bluesmiley
Member
Registered: 2006-03-21
Posts: 16
Website

Re: home page with links from multiple sections

Maniqui, thank you so much…that worked PERFECTLY!!!
http://myhomelesspage.com/

Above you can see exactly what I was shooting for. The if condition was just what I was hoping for but didn’t know about. I’m going to read up on it so I can use it in the future. This solution is actually WAY nicer than trying to create the effect with CSS.

Again, thank you so much for your help. This is great.

Offline

Board footer

Powered by FluxBB