Support » Plugins » All pages on one page

Viewing 14 replies - 1 through 14 (of 14 total)
  • Huh? You mean you’ve specified more or nextpage or something to break up the post, and you want a way to un-break it? Better description == better answer. 😉

    That sounds like it’s what Matt meant to me, and if it isn’t, well, that’s a question I want the answer to. For posts where I’ve used nextpage, is there any way to call all the pages at once?
    See, I’ll have some longer posts (the one I’m working on now will be 3500 words, give or take), and for obvious reasons I have to break them up using nextpage.
    On the other hand, much of my audience (should one exist) will not want to read 3500 words on the Web, no matter how it’s broken up.
    So I’ve got a print stylesheet all ready, but the way I break up my pages for posting is dictated by logic, not by layout. In other words, I break my content up using nextpage based on the flow of the article, not how many pages a section will turn out to be in hard copy.
    Any advice would be very helpful. I’m also trying to get southerngal’s WordCount hack to apply to the entire content of the post, instead of just the teaser that appears on the homepage (which is how my blog is set up, anyway).

    The work starts inside start_wp in functions.php. It breaks down multiple pages into the $pages array. I could see something where you have an extra parameter (defaults to false), say $multipageAsSingle or something like that. And if that’s passed in as true, instead of doing the explode() call, you’d just do a replace of the nextpage token with an empty string (to nuke all occurrances…).
    That’s pretty easy. I’d be interested to hear Matt’s (allusion) opinion on this, as to when to make a new global variable to set instead of new parameters…

    Yeah, in .72 it was start_b2 — sorry. 😉
    You can do something like:
    function start_b2 ( $force_single_page = 0 )
    That will cause the default to be zero, so it’ll work as it does currently.
    Then, the explode line needs to be broken out base on the variable. Something like:
    if ($force_single_page == 0)
    $pages = explode…
    $pages[0] = str_replace(‘<!–nextpage–>’, ”, $content);
    I just tested this, and I think that’s basically what you want.
    Then, you need to decide in what cases to show the entire contents. Now of course this isn’t something I’d normally want, so I might want to detect it somehow more complex based on the media type (i.e., page for printing) — not sure how to do that without explicit html request with something ?printable=1 or something tagged.
    The easiest way to test this on an explicit single-post page, which I detect with:
    if ($p!=””)
    … do something
    or you could test count($posts) or something like that… ;).

    Cool, glad it worked for you!
    Yeah, I’m not sure if there is an actual way to detect the media type in php and do different code — if there’s a guru out there that knows the answer, that’d help.
    The thing you could do is add a ‘printable page’ icon/link like many websites have, and have that go to a file like ‘singlepage.php’, which is a modified version of index.php but stripped down just to show the basic site title & full post (and no menus, etc.).

    Yeah, that’s what I think I’ll have to do (unless that guru you mentioned speaks up)…
    I had the print stylesheet ready to go anyway, and I already call my article views to a separate PHP file (article.php, as it happens), which I could very easily duplicate and modify as needed.
    It’s not as neat a solution as detecting the media type in PHP (which I’d love to do), but it’ll work.
    Thanks for your help,

    this is ENTIRELY off the top of my head. ymmv.

    function count_words($sometext)
    $words = explode(" ", $sometext);
    $wordcount = count($words);
    return $wordcount;
    function get_all_words()
    global $pages;
    $totalwords = 0;
    foreach ($pages as $page)
    $totalwords = $totalwords + count_words($page);


    Can’t thank you enough. Just had to add an echo ‘$totalwords words’ line at the very of the second function.

    Rather than use the preg_match thing, you could just do something like !empty($pages) or $multipage==1 as a faster test.

    Hey, thanks for the tip…(Devan here…away from home, trouble logging in, etc…) I’ll check those out when I get back…

    I was trying to get a “print page”, this is what I came up with:
    I made a javascript popup window link to open up the current post in a new window. I used a different “index.php” file, print.php which is stripped down to the following. Notice the for loop to loop through all the pages…
    <?php if ($posts) { foreach ($posts as $post) { start_b2(); ?>
    <?php $numpages; ?>
    <?php the_title(); ?>
    <?php for ($page = 1; $page <= $numpages; $page++) { ?> //the for loop displays all the pages*
    <?php the_content(); ?>
    <?php } } } // end foreach, end if any posts ?> //notice the extra }

    That Was me above…
    one more thing the print the page just put this in the body tag:

    That Was me above…
    one more thing the print the page just put this in the body tag:

    Hey Matt –
    Definitely a fine approach. I was looking to avoid a different php source, though my system would even benefit that approach by eliminating the page-loop.
    Also, if you know you’re on a single-post-page anyway, you can simplify further by doing:
    $post = $posts[0];
    .. instead of the normal outer foreach loop.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘All pages on one page’ is closed to new replies.