Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-03 15:06:26

Pablo Apiolazza
Member
From: Trieste, Italy
Registered: 2011-03-03
Posts: 19
Website

Single page with all sections as divs and no navigation

Hi, I’m new at this so probably I have some things wrong. I succesfully made a site with static and dynamic content, so I thought that I grasped the idea of it, but now I find myself completely clueless.

This is the structure I have:
It’s pretty much a portfolio, with an about, blog, work, clients and contact section.
About, clients and contact should be static sections.
Blog and probably work should be dynamic.

So far this doesn’t seem complicated. BUT….

This is what I want to do:

I want that the landing site (front, or default) to have ALL sections in that order (about, then blog with a small list of articles, then work, clients, and contact). No navigation to other pages, no single section page. Just scrollable content.
Each section should be a div, with the class name “section name” (if this is dynamic it would be better cause I’m planning to make the site multilingual with the MLP pack once it’s working).

A friend of mine suggested me the markup <txp:custom_article section=“section name”> to populate default, but it doesn’t show anything.

What would be the right way to do this?

I have already the static version working (my current portfolio). I want the same but made with textpattern, I thought it would be easier but it’s not.
The website is www.pabloapiolazza.com.ar

Thank you very much in advance for any help.

Offline

#2 2011-03-03 15:14:24

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

Re: Single page with all sections as divs and no navigation


My Plugins

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

Offline

#3 2011-03-03 15:14:24

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: Single page with all sections as divs and no navigation

Your friend is quite there: try <txp:article_custom section=“section name” form="section_form" /> instead… Inside default template repeat that for each section as needed, changing section, form, limit and everything.

PS: Still in Trieste? Like it?

Last edited by Zanza (2011-03-03 15:15:18)

Offline

#4 2011-03-03 16:11:23

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: Single page with all sections as divs and no navigation

Zanza’s solution is the method of choice if the content of your article forms shall vary quite a lot. (Hm, or is the method of choice what I propose in my edit?) If you consistently use the same tags for all your sections, and for dynamically adding of sections, try rah_repeat and something along these lines:

<txp:rah_repeat value='<txp:section_list exclude="comma-separated,sections,to,exclude" break=","><txp:section /></txp:section_list>'>
	<txp:article_custom section='<txp:rah_repeat_value />' form="section_form" wraptag="div" class='div-of-class-<txp:rah_repeat_value />' />">
</txp:rah_repeat>

Note: This is untested code, it’s rather “dreamt”, i.e. probably needs optimizing/corrections but worth a try.

EDIT: If you need varying tags for your forms and dynamically added sections, why not create several forms for them and tamper with some if_section conditionals around all these different form names in the above article tag’s form parameter? So if you have sections books and movie replace form="section_form" with

form='<txp:if_section name="books,movies">books-form</txp:if_section><txp:if_section name="blog">blog-form<txp:else />fallback-form</txp:if_section>'

Just thinking loud.

Last edited by uli (2011-03-03 17:02:49)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#5 2011-03-03 17:08:13

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,597
Website

Re: Single page with all sections as divs and no navigation

uli, could your code not be simplified as follows to not use rah_repeat:

<txp:section_list sections="about,blog,work,clients,contact">
   <div class="section" id="section_<txp:section />"> 
      <txp:article_custom section='<txp:section />'>
         <h2><txp:title /></h2>
         <txp:body />
      </txp:article_custom>
   </div>
</txp:section_list>

or am I not thinking straight today?

With the above if you need each article to display differently, you would handle that in your article body.

Another way would be to make the middle section as follows:

      <txp:article_custom section='<txp:section />' form='frontpage_<txp:section />' />

and then create a series of forms for each section, e.g. frontpage_about, frontpage_blog, frontpage_work, frontpage_clients and frontpage_contact that determine how each section should be handled. You have to create a form for each section.

EDIT: now I realize what you meant by dynamic addition of sections. I wonder whether you could do that by nesting txp:section_list and exclude inside txp:section_list… hmmm.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2011-03-03 17:33:48

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: Single page with all sections as divs and no navigation

jakob wrote:

uli, could your code not be simplified as follows to not use rah_repeat

I think you’re right, Julian.

And the longer I look at it the more I regret that I always thought of using this section list technique as a means of querying info for parsing purposes (inserting values into tags’ attributes) but not for displaying articles. Thanks for bringing this to my attention :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#7 2011-03-03 19:40:55

Pablo Apiolazza
Member
From: Trieste, Italy
Registered: 2011-03-03
Posts: 19
Website

Re: Single page with all sections as divs and no navigation

Hi guys, thank you so much for the help.

Sadly for some reason it’s not working. There’s no article being displayed.
I’m trying with the “work” section

http://pastebin.com/PkNnQ7i8

The article in “what” section is sticky and it belongs to the “what” section
The test form is really simple too.

<div class="work"> <h3><txp:title /></h3> <txp:body /> </div>

All the rest displays fine, they are just html chunks.

I get no errors but neither articles. I don’t get it.

PS: BTW Zanza, how do you know I’m in Trieste? :O
It’s nice so far.

Last edited by Pablo Apiolazza (2011-03-03 19:42:32)

Offline

#8 2011-03-03 19:56:49

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: Single page with all sections as divs and no navigation

Excuse the question: are there articles in the work section?

Edit: if you mixed up the what section with the work section in the above post: sticky articles need an additional status="sticky" in the article_custom tag.

Last edited by uli (2011-03-03 19:59:31)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2011-03-03 20:01:43

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

Re: Single page with all sections as divs and no navigation

It would help if you posted a tag trace.

Offline

#10 2011-03-03 20:12:38

Pablo Apiolazza
Member
From: Trieste, Italy
Registered: 2011-03-03
Posts: 19
Website

Re: Single page with all sections as divs and no navigation

uli wrote:

Excuse the question: are there articles in the work section?

Edit: if you mixed up the what section with the work section in the above post: sticky articles need an additional status="sticky" in the article_custom tag.

Hey that was the problem! the status thing. Damn, thanks I was loosing it.

I’ll populate the site now and keep you updated.
Thank you so much!

Last edited by Pablo Apiolazza (2011-03-03 20:13:09)

Offline

#11 2011-03-03 20:18:16

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,304

Re: Single page with all sections as divs and no navigation

Please note that article tags with a status="sticky" will only display sticky articles, i.e. each further article to be displayed by this tag has to be a sticky.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#12 2011-03-03 21:18:59

Pablo Apiolazza
Member
From: Trieste, Italy
Registered: 2011-03-03
Posts: 19
Website

Re: Single page with all sections as divs and no navigation

Yupp, I thought it was the right approach for those static sections.
Is that right?

Offline

Board footer

Powered by FluxBB