Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Extensions / Random page link on index

musashi9
#1 2017-02-12 12:25

Is there a plugin that shows a random page from the database with a link to it on the index page.

I have over 1000 pages on my site and a nice little random link generator will work wonders.

 

Kort
#2 2017-02-12 20:53

Pagelist Plugin

Use it like:

{PHP|pagelist('pagelist.sometpl','1','RAND()')}

... or add parameters to suit your needs

Seditio.by - создание сайтов, разработка плагинов и тем для Котонти
musashi9
#3 2017-02-13 00:18

Ah good stuff, can someone help me config it for my needs?

I would like to show 5 random links from only 2 categories (I dont need pages from ...news,general, ect...)

Is it also possible to only show the page ID name not all the folders before it (instead of General news > page-id=1) Just show page-id=1

Thanks

Kort
#4 2017-02-14 10:22

Callback in the template:

{PHP|pagelist('pagelist.random','5','RAND()', '', '', '', 'cat1;cat2')}

Simple template (pagelist.random.tpl):

<!-- BEGIN: MAIN -->
<!-- BEGIN: PAGE_ROW -->
	{PAGE_ROW_ID}
<!-- END: PAGE_ROW -->
<!-- END: MAIN -->

 

Seditio.by - создание сайтов, разработка плагинов и тем для Котонти
musashi9
#5 2017-02-14 14:44

Amazing thanks. How do I get it to show  the 5 in a table/rows

Kort
#6 2017-02-20 17:02

Easy:

<!-- BEGIN: MAIN -->
<table>
  <tbody>
<!-- BEGIN: PAGE_ROW -->
    <tr><td>{PAGE_ROW_ID}</td></tr>
<!-- END: PAGE_ROW -->
  </tbody>
</table>
<!-- END: MAIN -->

 

Seditio.by - создание сайтов, разработка плагинов и тем для Котонти