ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Display current page in title, with pagination activated

October 09, 2009 5:59am

Subscribe [2]
  • #1 / Oct 09, 2009 5:59am

    Fabrice P.

    18 posts

    Hello,

    I use Weblog Entry and Comment Pagination and it works great, but all pages have the same title.

    I would like to display in the page title something like this :

    TITRE - Page XX

    I use this code:

    <title>{site_name} • Commentaires d'articles{if segment_2 != ""} - page {segment_2}{/if}</title>

    This is not perfect, because it displays Page P7 or Page P14 instead of Page 2 or Page 3, but now all pages have a unique title.

    Any ideas or plugins to display real page number?

    Fabrice

  • #2 / Oct 09, 2009 8:53am

    Ingmar

    29245 posts

    Some PHP to remove the ‘P’, and divide the number by the number of articles or comments shown on one page. Should be rather trivial.

  • #3 / Oct 09, 2009 9:06am

    Fabrice P.

    18 posts

    ok thank you Ingmar

    I would have prefered not to use php, because I am always worried about security concerns.

    Anyway the trivial code is :

    <title>TITLE{if segment_2 != ""} - page <?php echo (intval(substr('{segment_2}', 1)) / 7 + 1) ?> {/if}</title>
  • #4 / Oct 09, 2009 10:19am

    Ingmar

    29245 posts

    What security concerns? That’s only an issue if you give a non-Admin the right to edit this template. If that’s an issue you can always create your own plugin, of course.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases