Selective rendering of part of a page

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul E Collins

    Selective rendering of part of a page

    I want to skip the rendering of certain parts of a Web page if the
    user doesn't have a certain permission (e.g. a cookie). I'd like to do
    it along these lines:

    <p>Anybody can see this paragraph.</p>
    <? start_protected _section($got_p ermission); ?>
    <p>Not everybody can see this paragraph.</p>
    <? end_protected_s ection(); ?>

    Is it possible to disable the rendering of a section outside the code
    like this (perhaps by setting a PHP flag to redirect subsequent
    output)? I don't really want to complicate things by moving part of
    the page into a separate "include file" or mixing the HTML and PHP by
    using a here-document (the <<<END syntax).

    Eq.


  • Geoff Berrow

    #2
    Re: Selective rendering of part of a page

    Message-ID: <BIedncwyzLVbaR HYnZ2dnUVZ8qCqn Z2d@bt.comfrom Paul E
    Collins contained the following:
    ><p>Anybody can see this paragraph.</p>
    ><? start_protected _section($got_p ermission); ?>
    ><p>Not everybody can see this paragraph.</p>
    ><? end_protected_s ection(); ?>
    >
    >Is it possible to disable the rendering of a section outside the code
    >like this (perhaps by setting a PHP flag to redirect subsequent
    >output)? I don't really want to complicate things by moving part of
    >the page into a separate "include file" or mixing the HTML and PHP by
    >using a here-document (the <<<END syntax).
    <?php
    if($condition){
    ?>
    protected html here
    <?php
    }
    ?>

    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Umberto Salsi

      #3
      Re: Selective rendering of part of a page

      "Paul E Collins" <find_my_real_a ddress@CL4.orgw rote:
      I want to skip the rendering of certain parts of a Web page if the
      user doesn't have a certain permission (e.g. a cookie). I'd like to do
      it along these lines:
      >
      <p>Anybody can see this paragraph.</p>
      <? start_protected _section($got_p ermission); ?>
      <p>Not everybody can see this paragraph.</p>
      <? end_protected_s ection(); ?>
      >
      Is it possible to disable the rendering of a section outside the code
      like this (perhaps by setting a PHP flag to redirect subsequent
      output)? I don't really want to complicate things by moving part of
      the page into a separate "include file" or mixing the HTML and PHP by
      using a here-document (the <<<END syntax).

      Mostly HTML, few PHP. Enclose the PHP code between <? ?:

      <p>Anybody can see this paragraph.</p>

      <? if( $got_permission ){ ?>

      <p>Not everybody can see this paragraph.</p>

      <? } ?>



      Mostly PHP, few HTML. Enclose the HTML code between ?<? :

      ?<p>Anybody can see this paragraph.</p<?

      if( $got_permission ){

      ?<p>Not everybody can see this paragraph.</p<?

      }


      Regards,
      ___
      /_|_\ Umberto Salsi
      \/_\/ www.icosaedro.it

      Comment

      • seaside

        #4
        Re: Selective rendering of part of a page


        Paul E Collins schrieb:
        I want to skip the rendering of certain parts of a Web page if the
        user doesn't have a certain permission (e.g. a cookie). I'd like to do
        it along these lines:
        >
        <p>Anybody can see this paragraph.</p>
        <? start_protected _section($got_p ermission); ?>
        <p>Not everybody can see this paragraph.</p>
        <? end_protected_s ection(); ?>
        Go and download a template engine like Smarty



        and separate your code from your layout. I use it for quite some time
        and maintainability of code is much better.

        Comment

        Working...