Loading...
 
Features / Usability

Features / Usability


How to print all wiki pages in a category?

posts: 3665 United States

Anyone have a mod or hack that will all me to print all wiki pages in a specific category? Basically, I'd like to use the mulit-print page, and have all the wiki pages in a specific category be selected.

Tx,

-Rick

posts: 3665 United States

OK, so it wasn't as hard as I thought. redface

Basically, you simply need to build an array of all the pages, then pass it to the tiki-print_pages.php. I added the following code to the cateobjects.tpl template:
<form action="tiki-print_pages.php" method="post"> <input type="hidden" name="printpages" value='a:{$i|@count}:{literal}{{/literal}{section name=o loop=$i}i:{$smarty.section.o.index};s:{$i[o].name|count_characters inclue_spaces=true}:"{$i[o].name}";{/section}{literal}}{/literal}' /> <input type="submit" name="printarticles{$title}" value="{tr}Print All {$title} Articles{/tr}" / </form>

Now, when I use the {CATEGORY} plugin, I get a button that will pre-load all the wiki pages into the Selected Pages area of the multi-print (tiki-print_pages.php) page. If your category includes objects in addition to wiki pages, you may want to enclose the {section} loop with an IF statement, to verify that the page is a wiki page.

If anyone can improve the code, please feel free!

HTH,

-Rick

posts: 1

Can't improve on your code - it looks a bit beyond me, but thought you might find this info useful.

We use a Structure to organise our Wiki pages for printing.

Then we go to (menu) wiki, print, choose the structure and then press the Add Structure button.

This works well except there's no page breaks between consecutive wiki pages - it's just a continuous print.

The way around this was to:

1) add the following command to the active stylesheet:
.break { page-break-before: always; }

2) edited tiki-print_multi_pages.tpl and added the line:
(i've used ~ to indicate gt and lt signs as the forum doesn't allow HTML tags)
~h1 class="break"~~/h1~

under the bit that starts with
{section name=ix loop=$pages}

This works really well. I'm sure there's a better way but this worked well.

Nick.

> OK, so it wasn't as hard as I thought. redface
>
> Basically, you simply need to build an array of all the pages, then pass it to the tiki-print_pages.php. I added the following code to the cateobjects.tpl template:
> > <form action="tiki-print_pages.php" method="post"> > <input type="hidden" name="printpages" value='a:{$i|@count}:{literal}{{/literal}{section name=o loop=$i}i:{$smarty.section.o.index};s:{$i[o].name|count_characters inclue_spaces=true}:"{$i[o].name}";{/section}{literal}}{/literal}' /> > <input type="submit" name="printarticles{$title}" value="{tr}Print All {$title} Articles{/tr}" / > </form> >
>
> Now, when I use the {CATEGORY} plugin, I get a button that will pre-load all the wiki pages into the Selected Pages area of the multi-print (tiki-print_pages.php) page. If your category includes objects in addition to wiki pages, you may want to enclose the {section} loop with an IF statement, to verify that the page is a wiki page.
>
> If anyone can improve the code, please feel free!
>
> HTH,
>
> -Rick
>
>

posts: 1817 Catalan Countries

Hey, Nick, and Ricks, great tricks.
Can you commit this to cvs? (1.9 and 1.10?)
It would be great to have this onto base Tiki code...
Cheers,
Xavi

posts: 3665 United States

> 1) add the following command to the active stylesheet:
> .break { page-break-before: always; }
>
> 2) edited tiki-print_multi_pages.tpl and added the line:
> (i've used ~ to indicate gt and lt signs as the forum doesn't allow HTML tags)
> ~h1 class="break"~~/h1~
>


I used a similar approach for my Tiki. But I've noticed that, while it works for IE, Firefox (1.5 and 2.x) seems to choke on this — generating very odd print results. Have you had problems?

Tx,

-Rick