Page 1 of 1

Articles with more than one page.

Posted: Mon Jun 26, 2006 4:33 pm
by Zuke
So, when making content, it goes into the menu no matter what, right?  How can I add conent that is spread across maybe 3 or 4 pages without having all the pages show up in the menu?

Here's sort of how it would go right now:

Main Nav
        V
        Section
                V
                Article Page 1
                Article Page 2
                Article Page 3
                Article Page 4

And I'd want it to only show page one, then at the bottom it would have nav links to the next pages in the article.  Any idea how to do this?
         

Re: Articles with more than one page.

Posted: Mon Jun 26, 2006 4:56 pm
by slloyd
Yes, you can eliminate a file from the menu! If you go to Content > Pages then go to the page you want to remove from the menu. Click on the Options tab. Uncheck the Show in Menu checkbox.

I believe there's an easy way of creating Next and Previous links, too, but I'm not sure. Maybe one of the other forum members can help you with that.

Re: Articles with more than one page.

Posted: Mon Jun 26, 2006 5:38 pm
by westis
Hi Zuke,

You can do next/previous links by using {cms_selflink dir="previous"}and {cms_selflink dir="next"}. You can put this in the page content or use a separate template for those pages and put the cms_selflink tag in that template.

I wish there was a pagination tag that would make several pages of one CMSMS page, by putting a tag like {page_break} where one wants the page breaks to be. But there isn't such a tag yet.

So slloyd's method is probably the only way to do it so far.

Re: Articles with more than one page.

Posted: Mon Jun 26, 2006 6:51 pm
by Zuke
Hmm.  Problem with the net page tag is it will take the reader straight out of the article they are reading and onto the next page on the site.  Correct?

This workaround also leaves the problem that when I want to move an article or archive it, I actually have to handle each separate page as a separate article, and not a part of the whole.

Re: Articles with more than one page.

Posted: Tue Jun 27, 2006 5:00 am
by cyberman
westis wrote: I wish there was a pagination tag that would make several pages of one CMSMS page, by putting a tag like {page_break} where one wants the page breaks to be. But there isn't such a tag yet.
Hmm, perhaps it can be done by smarty  ::)

http://www.phpinsider.com/php/code/SmartyPaginate/
http://jayseae.cxliv.org/2005/03/31/aut ... ation.html

Re: Articles with more than one page.

Posted: Tue Jun 27, 2006 3:54 pm
by Zuke
I'm going to sound like an idiot, but I'm not sure I understand most of those instructions.  I'm still trying to hack my way through PHP and whatnot; I haven't even touched the smarty template system that CMSMS uses.  If it works, great!  If not, I wrap it in {literal}.

The instructions sort of left me behind pretty quickly.  Anyway you can translate them into the down and dirty?

Re: Articles with more than one page.

Posted: Wed Jun 28, 2006 12:01 am
by Dr.CSS
have you tried a selflink to the next page at the bottom of your content, you would have to make all the pages first...

Re: Articles with more than one page.

Posted: Wed Jun 28, 2006 1:26 am
by Zuke
Well yeah, but as I said above, if I do that, at the end of the article it wouldn't say leading into the NEXT article.

Re: Articles with more than one page.

Posted: Sun Feb 17, 2008 11:46 am
by alinome.net
I have a similar problem. I don't want "prev" and "next" links to work outside the current menu branch! It would be very useful {cms_selflink} to have a parameter to limit its scope to a certain parent.

At the end of this post an user  suggests his own patch to {cms_selflink} to achieve that (though only for next, not for prev).

Another solution could be to use {menu} instead: you could call {menu} at the bottom of those four pages with the right parameters (e.g. start_level) to show buttons to navigate only through them.

Re: Articles with more than one page.

Posted: Sun Feb 17, 2008 5:10 pm
by Dr.CSS
alby has a pagination tag that uses {page/break} iirc...

The only thing about the menu idea is how to restrict it to only one next/prev. page...

Re: Articles with more than one page.

Posted: Mon Feb 18, 2008 4:34 pm
by alinome.net
mark wrote: The only thing about the menu idea is how to restrict it to only one next/prev. page...
Right. I thought of as many buttons as pages the document has: [page1] [page2] [page3] [page4]... That can be achieved easily with {menu} but is not what Zuke needed.

These days I found a solution. It's a bit rough, but it works fine. It's not a general solution, but can be adapted to other sites.

The personal site I'm building consists of letters. Every single letter can belong to one or more branches in the hierarchy. To solve that I invented a cross tagging system (I will explain that later in other thread). Well, every menu category is a page that lists all letters under that category, but the letters are all together and apart under an independent menu root parent.

While the user browses letters, I don't want "prev" and "next" go out of the current branch, e.g. to the categories pages, or the "contact" page or whatever.

The solution I found is to capture the output of {cms_selflink} and to print it or not depending on its content.

This is the simple code needed in the template:

Code: Select all

<div id='letternav'>

{capture assign='letter_link'}
{cms_selflink dir="prev" label='Anterior: '}
{/capture}
{letter_link link=$letter_link id='prevletter'}

{capture assign='letter_link'}
{cms_selflink dir="next" label='Siguiente: '}
{/capture}
{letter_link link=$letter_link id='nextletter'}

</div> <!-- letternav -->
And this is the simple code of the UDT {letter_link}:

Code: Select all

/*

Show a link if it links to a letter page.

*/

$link = $params['link'];
$link_id = isset($params['id']) ? ' id="'.$params['id'].'"' : '' ;

if ( ereg('.*[lc]{1}[0-9]{8}.*', $link) )
{
  echo '<div class="letternavbutton"'.$link_id.'>'.$link.'</div>';
}

You see, I profit the fact that all the pages I want to show are named in a similar way: the first letter is "l" or "c" (my site is bilingual) and the rest is the date in the format "yyyymmdd". I just print links that have such a string in the XHTML code because there is no possible coincidence with other pages of the site. I think Zuke's article pages have similar names too, so this can be a possible solution.

The filter could be more elaborate, e.g. getting the page parent root, but this one is enough for me.