Pagination for news articles.
Posted: Mon Jun 18, 2007 3:36 am
Hi everyone,
I need help simplifying in the pagination for news articles.
I using the system that can be found (with instructions) at http://www.dynamicdrive.com/dynamicinde ... nation.htm.
Its all done in javascript, but you don't need to know javascript to use it. To get this working, I need people who know HTML and PHP (mainly PHP).
This javascript pagination system can be easily adapted into CMSMS, but when creating news articles, it hard.
I want to create user defined tags in order to make it much more simpler for those editors who don't understand programming.
For the development, we will user Demo 5, which is the one with the drop down box.
All of the pages in the article need to be split up with tags. So instaed of getting editors to put:
...
to separate pages.
Will can make UDT.
{spage} //s is for start
echo "";
{epage} //e is for end
echo "";
I was planing on using {page} and {/page} like the if statement, but I got errors because / is an invalid character, does anyone know away around this?
At the end of each page, we need to add the following code:
Prev Next
var gallery=new virtualpaginate("virtualpage5", 1)
gallery.buildpagination("galleryselect", ["castle", "park", "harvest", "country"])
In the there is the line
gallery.buildpagination("galleryselect", ["castle", "park", "harvest", "country"])
castle, park, harvest, country, all represent the values for each page, these appear in the drop down box aswell.
Firstly, instead of adding that to the bottom of the page, will put it in a UDT, we will call it pagination.
So that works all fine. But we obviously don't want every article to have 4 pages called caste, park, harvest and country do we. We can use the $params['text here'] variable so that the editors can name their pages. So we can change it to:
gallery.buildpagination("galleryselect", [\"".$params['page1']."\", \"".$params['page2']\", \"".$params[page3']\", \"".$params['page4']."\"])
Well thats all plan and simple, isn't it. Now all the edit has to do for an arictle is type:
{spage}
Page 1
{epage}
{spage}
Page 2
{epage}
{spage}
Page 3
{epage}
{spage}
Page 4
{epage}
{pagination page1="Page 1" page2="Page 2" page3="Page 3" page4="Page 4"} //that will automatically fill the javascript section.
But now for the tricky part...
What if the article had 7 pages? That would mean the editor would have to edit the UDT, and change that javascript line, everytime he want to make a new article that was different length to the last. Yes, this is where I got stuck and now need help.
We need it to automatically count the number of pages the user has created. Anyone can do that, just add $i++ to {spage}.
But for every page, me need to make a new variable, and then output that into the javascript section, with the valid syntax.
How do we get it to do this, that I don't not know, and I now need help from a more advanced programmer.
Cheers,
Cobby
Sorry for the unorganized post, but I found it difficult to explain my question.
I need help simplifying in the pagination for news articles.
I using the system that can be found (with instructions) at http://www.dynamicdrive.com/dynamicinde ... nation.htm.
Its all done in javascript, but you don't need to know javascript to use it. To get this working, I need people who know HTML and PHP (mainly PHP).
This javascript pagination system can be easily adapted into CMSMS, but when creating news articles, it hard.
I want to create user defined tags in order to make it much more simpler for those editors who don't understand programming.
For the development, we will user Demo 5, which is the one with the drop down box.
All of the pages in the article need to be split up with tags. So instaed of getting editors to put:
...
to separate pages.
Will can make UDT.
{spage} //s is for start
echo "";
{epage} //e is for end
echo "";
I was planing on using {page} and {/page} like the if statement, but I got errors because / is an invalid character, does anyone know away around this?
At the end of each page, we need to add the following code:
Prev Next
var gallery=new virtualpaginate("virtualpage5", 1)
gallery.buildpagination("galleryselect", ["castle", "park", "harvest", "country"])
In the there is the line
gallery.buildpagination("galleryselect", ["castle", "park", "harvest", "country"])
castle, park, harvest, country, all represent the values for each page, these appear in the drop down box aswell.
Firstly, instead of adding that to the bottom of the page, will put it in a UDT, we will call it pagination.
So that works all fine. But we obviously don't want every article to have 4 pages called caste, park, harvest and country do we. We can use the $params['text here'] variable so that the editors can name their pages. So we can change it to:
gallery.buildpagination("galleryselect", [\"".$params['page1']."\", \"".$params['page2']\", \"".$params[page3']\", \"".$params['page4']."\"])
Well thats all plan and simple, isn't it. Now all the edit has to do for an arictle is type:
{spage}
Page 1
{epage}
{spage}
Page 2
{epage}
{spage}
Page 3
{epage}
{spage}
Page 4
{epage}
{pagination page1="Page 1" page2="Page 2" page3="Page 3" page4="Page 4"} //that will automatically fill the javascript section.
But now for the tricky part...
What if the article had 7 pages? That would mean the editor would have to edit the UDT, and change that javascript line, everytime he want to make a new article that was different length to the last. Yes, this is where I got stuck and now need help.
We need it to automatically count the number of pages the user has created. Anyone can do that, just add $i++ to {spage}.
But for every page, me need to make a new variable, and then output that into the javascript section, with the valid syntax.
How do we get it to do this, that I don't not know, and I now need help from a more advanced programmer.
Cheers,
Cobby
Sorry for the unorganized post, but I found it difficult to explain my question.