How to output all pages in one long page?

General questions about CMSimple
Korvell
Posts: 88
Joined: Thu May 22, 2008 10:33 pm

How to output all pages in one long page?

Postby Korvell » Wed Aug 09, 2017 12:15 am

I have been searching high and low without luck - but I'm sure I have read somewhere that it is (or maybe has been) possible to output all pages in a site in one single long page with all headings and formatting - using just a single function or script command. Am I wrong?


Korvell
Posts: 88
Joined: Thu May 22, 2008 10:33 pm

Re: How to output all pages in one long page?

Postby Korvell » Wed Aug 09, 2017 8:43 am

Thanks.
But that require a new template. I need a way to display a present site with lots of submenus as a single long page on user request to print out the whole site.
I'm positive that I remember something about an internal function of CMSimple like #CMSimple $output.= something...#

Hartmut
Posts: 345
Joined: Sat Nov 05, 2011 6:13 pm
Location: Butzbach, Deutschland
Contact:

Re: How to output all pages in one long page?

Postby Hartmut » Wed Aug 09, 2017 9:02 am

Hello,
Korvell wrote:Thanks.
But that require a new template. I need a way to display a present site with lots of submenus as a single long page on user request to print out the whole site.
I'm positive that I remember something about an internal function of CMSimple like #CMSimple $output.= something...#

maybe the plugin "simplePDF" (http://cmsimplexh.webdesign-keil.de/?CM ... s/Vorschau) is a good solution?
An example can be found on the following page: http://cmsimplexh.webdesign-keil.de/?Fa ... _erstellen => "Kapitel mit Unterseiten als PDF speichern"

Best regards
Hartmut

Korvell
Posts: 88
Joined: Thu May 22, 2008 10:33 pm

Re: How to output all pages in one long page?

Postby Korvell » Wed Aug 09, 2017 10:31 am

That would cover my needs I think. Unfortunately there's no download for it on Holgers site anymore...

ZiPs
Posts: 633
Joined: Thu May 22, 2008 6:17 pm
Location: Faxe, Denmark
Contact:

Re: How to output all pages in one long page?

Postby ZiPs » Wed Aug 09, 2017 10:37 am

In the old CMSimple this display the content.

Code: Select all

#CMSimple $output.=rf($pth['file']['content']);#

/ZiPs
Preben Dahl | Webmaster cmsimple.dk | Projekt-og domæne ejer Gert Ebersbach

Korvell
Posts: 88
Joined: Thu May 22, 2008 10:33 pm

Re: How to output all pages in one long page?

Postby Korvell » Wed Aug 09, 2017 1:57 pm

Thanks - looks somewhat like what I remember although not completely - I remember it a tad bit shorter. But it works - almost - it just puts out some of the extra hidden content from each page:

Code: Select all

'Forside', 'last_edit'=>'1502268549', 'description'=>'', 'keywords'=>'', 'title'=>'', 'robots'=>'', 'heading'=>'', 'show_heading'=>'1', 'template'=>'0', 'published'=>'1', 'show_last_edit'=>'0', 'linked_to_menu'=>'1', 'header_location'=>'', 'use_header_location'=>'0', 'publication_date'=>'', 'expires'=>'' ); ?>

Guess I'll just have to omit this feature on my site until further notice.

cmb
Posts: 11424
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: How to output all pages in one long page?

Postby cmb » Wed Aug 09, 2017 2:33 pm

Korvell wrote:but I'm sure I have read somewhere that it is (or maybe has been) possible to output all pages in a site in one single long page with all headings and formatting - using just a single function or script command.

AFAIK, this never has been possible. ZIPs' suggestion above would output the whole contents, but without evaluating CMSimple scripting and plugin calls. Something similar is easily possible with current CMSimple_XH versions, but that is most likely not what you're looking for.

http://3-magi.net/demo/infinite/ also is probably not what you're looking for, even though it is possible to scroll to bottom, and to print out the complete website in one go.

Korvell wrote:That would cover my needs I think. Unfortunately there's no download for it on Holgers site anymore...

The plugin has not been published, unfortunately.

Korvell wrote:I need a way to display a present site with lots of submenus as a single long page on user request to print out the whole site.

It seems to me that you're looking for an "expanded" submenu(), which shows all subpages (and subpages of the subpages), but only if the print preview is requested. If so, you can put the following in cmsimple/userfuncs.php:

Code: Select all

<?php

class ExpandedSubmenu
{
    private $pages;

    public function __construct()
    {
        $this->pages = new XH\Pages;
    }

    public function render()
    {
        global $print, $s;

        $html = '';
        $old_s = $s;
        foreach ($this->pages->children($s) as $page) {
            $html .= $this->renderPage($page);
        }
        $s = $old_s;
        return $html;
    }

    private function renderPage($index)
    {
        global $c, $s;

        $s = $index;
        $html = XH_convertPrintUrls(evaluate_scripting($c[$index]));
        foreach ($this->pages->children($index) as $page) {
            $html .= $this->renderPage($page);
        }
        return $html;
    }
}

function submenu_print()
{
    return (new ExpandedSubmenu)->render();
    

Then you have to change this line to:

Code: Select all

        $content, submenu_print(), $bjs, '</body>', "\n", '</html>', "\n"
Christoph M. Becker –Plugins for CMSimple_XH, but not for CMSimple 4+

Korvell
Posts: 88
Joined: Thu May 22, 2008 10:33 pm

Re: How to output all pages in one long page?

Postby Korvell » Wed Aug 09, 2017 4:07 pm

Thanks Christoph.

Looking back in my files archive of the old original CMSimple from the days of Peter Harteg I found the code I thought I remembered - and it is the same, that ZIP posted :)

That 'infinite' feature is quite nice - it could work well for my site I think.

As for the code snippet I'm not sure where to change the second part. My site runs version 1.6.9...

This is the site I'm working on: sk.egmont-hs.dk/

cmb
Posts: 11424
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: How to output all pages in one long page?

Postby cmb » Wed Aug 09, 2017 4:34 pm

Korvell wrote:That 'infinite' feature is quite nice - it could work well for my site I think.

The demo is pretty old, and I'm not sure about the code – I'll check it out ASAP.

Korvell wrote:As for the code snippet I'm not sure where to change the second part. My site runs version 1.6.9...

Then you have to replace this line with:

Code: Select all

        $content, submenu_print(), '</body>', "\n", '</html>', "\n";

Also you have to use the following code in cmsimple/userfuncs.php instead (this code should also work with XH 1.7.0):

Code: Select all

<?php

class ExpandedSubmenu
{
    private $pages;

    public function __construct()
    {
        $this->pages = new XH_Pages;
    }

    public function render()
    {
        global $print, $s;

        $html = '';
        $old_s = $s;
        foreach ($this->pages->children($s) as $page) {
            $html .= $this->renderPage($page);
        }
        $s = $old_s;
        return $html;
    }

    private function renderPage($index)
    {
        global $c, $s;

        $s = $index;
        $html = XH_convertPrintUrls(evaluate_scripting($c[$index]));
        foreach ($this->pages->children($index) as $page) {
            $html .= $this->renderPage($page);
        }
        return $html;
    }
}

function submenu_print()
{
    return (new ExpandedSubmenu)->render();
    
}
Christoph M. Becker –Plugins for CMSimple_XH, but not for CMSimple 4+


Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest