PostNuke: A Flexible Open Source Content Management System
home | forum | international support | contact us

Support Forum

Start ::  Developers Corner ::  0.8 Theme Design ::  Link in Header Should Change: Login - Logout

Moderated by: Support Team

Bottom
Link in Header Should Change: Login - Logout

  • Link to this postingPosted: 18.10.2007, 09:09
    Profile Homepage
    pptous
    rank:
    pnSoftmore pnSoftmore
    registered:
     June 2002
    Status:
    offline
    last visit:
    24.01.08
    Posts:
    51
    Hello PostNukers,
    I am using the theme andreas08 in PN 0.8 on a LAMP server.
    When a visitor arrives at the site, they should see a link in the theme header named "Login". After the user logs in, the link should change and then read "Logout". We used this in previous PN releases/themes successfully, but now when I use the same code, it's a no-go. This is the code I am trying:
    Code
    <?
    if (!pnUserLoggedIn()) {
           echo "<a href=\"user.php?op=loginscreen&module=NS-User\">Login</a>\n";
         } else {
           echo "<a href=\"user.php?module=NS-User&op=logout\">Logout</a>";
         }
    ?>

    This code leaves me with code displayed in the header where the link "Login" should be. I know you guys are cracks and can help my sorry soul in solving this problem!
    Thanks,
    Pepe
  • Link to this postingPosted: 18.10.2007, 10:14
    Profile Homepage
    markwest
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    24.04.08
    Posts:
    7647
    You can't embed PHP code into templates directly. There is a theme plugin provided to give you the kind of links your after. The userlinks plugin is closest to your requirements.

    For full information on themeing in v0.8 see the theming documenation.

    -Mark
  • Link to this postingPosted: 18.10.2007, 10:25
    Profile Homepage
    videokid
    rank:
    pnProfessional pnProfessional
    registered:
     March 2003
    Status:
    offline
    last visit:
    07.05.08
    Posts:
    806
    Lazy me, I use frequently
    Code
    <!--[php]--> <!--[/php]-->


    I guess it's not advised, and certainly not in 0.8.x themes??

    - Igor
    -----
    Have a nice day
    PostNuke.be is currently running
    PN 0.8.0.0-RC3
  • Link to this postingPosted: 18.10.2007, 10:54
    Profile Homepage
    markwest
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    24.04.08
    Posts:
    7647
    While PHP tags are available it's not really the recommend method. If you build a plugin you can use it anywhere - in different templates even on different sites.

    Turning (almost) any PHP into a plugin is a relatively simple task.

    -Mark
  • Link to this postingPosted: 18.10.2007, 12:09
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635

    Code
    <?
    if (!pnUserLoggedIn()) {
           echo "<a href=\"user.php?op=loginscreen&module=NS-User\">Login</a>\n";
         } else {
           echo "<a href=\"user.php?module=NS-User&op=logout\">Logout</a>";
         }
    ?>

    ...and my way...
    Code
    <!--[if pnuserloggedin($loggedin) eq 1]-->
        <a href="user.php?op=loginscreen&module=NS-User">Login</a>
    <!--[else]-->
        <a href="user.php?module=NS-User&op=logout">Logout</a>
    <!--[/if]-->

    Flexible enough for ya... three solutions and styles..



    edited by: AmmoDump, Oct 18, 2007 - 07:10 AM
    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 19.10.2007, 12:34
    Profile Homepage
    videokid
    rank:
    pnProfessional pnProfessional
    registered:
     March 2003
    Status:
    offline
    last visit:
    07.05.08
    Posts:
    806
    @Mark: ok, noted.

    @AmmoDump
    I think it's the other way around.... LOL
    Code
    <!--[if pnuserloggedin($loggedin) eq 1]-->
    <a href="user.php?module=NS-User&amp;op=logout" title="[ Uitloggen ]">Logout</a>
    <!--[else]-->
    <a href="user.php?op=register&amp;module=NewUser" title="[ Registreer ]">&nbsp;Registreer&nbsp;</a>
    <a href="user.php?op=loginscreen&amp;module=User" title="[ Inloggen ]">&nbsp;Log in&nbsp;</a>
    <!--[/if]-->


    - Igor
    -----
    Have a nice day
    PostNuke.be is currently running
    PN 0.8.0.0-RC3
  • Link to this postingPosted: 19.10.2007, 22:19
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    Indeed it is, Igor! icon_rolleyes

    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 19.10.2007, 22:21
    Profile Homepage
    markwest
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    24.04.08
    Posts:
    7647
    Note that for .8x those links are right - they're the .7x versions of the links.

    -Mark
  • Link to this postingPosted: 22.10.2007, 10:43
    Profile Homepage
    pptous
    rank:
    pnSoftmore pnSoftmore
    registered:
     June 2002
    Status:
    offline
    last visit:
    24.01.08
    Posts:
    51
    Postnukers are cool!!! Thanks for your help everybody. Tried all options and all work great. Next time you guys are in the neighborhood, stop by for a beer.

    Pepe
  • Link to this postingPosted: 22.10.2007, 15:10
    Profile Homepage
    AmmoDump
    rank:
    pnProfessional pnProfessional
    registered:
     December 2003
    Status:
    offline
    last visit:
    08.05.08
    Posts:
    2635
    pptousPostnukers are cool!!!


    The coolest!

    Nothing dazzles people at a party like talking about dynamic theme rendering techniques. My wife thinks I talk about it to 'pick-up chicks'. But she looks hot in her 'Talk < -- $marty -- > to me baby-doll tee... LOL


    -----
    -- David Pahl -- (PostNuke Support Team)

    <div id="me" class="none" style="none" />

  • Link to this postingPosted: 24.10.2007, 03:12
    Profile
    Topiatic
    rank:
    pnProfessional pnProfessional
    registered:
     November 2003
    Status:
    offline
    last visit:
    09.05.08
    Posts:
    1530
    AmmoDumpNothing dazzles people at a party like talking about dynamic theme rendering techniques. My wife thinks I talk about it to 'pick-up chicks'.


    Maybe it's my geographic location, or my social circles, but all I get is eyes glazing over when I even mention anything beyond windows or internet... although gaming occasionaly gets a good reaction.

    -----
    viewTopiaryWorks($twWorks, $twRosterMaster)

Start ::  Developers Corner ::  0.8 Theme Design ::  Link in Header Should Change: Login - Logout

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to PostNuke