+ Reply to Thread
Results 1 to 8 of 8

Thread: Parsing PHP in skins

  1. #1
    forkless is offline Roundcube Newcomer
    Join Date
    Feb 2010
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default Parsing PHP in skins

    Hi there,

    I'm currently trying to personalize the skins for the different domains it is running on however I can't seem to get the PHP parsed in the html located in the skins folder.

    - The handlers in .htaccess have been appropriately set
    - A plain html page with php inclusion will run fine
    - The main.inc.php has the $rcmail_config['skin_include_php'] config setting set as true (tried both true and TRUE, shouldn't really matter I suppose)
    - Both releases I run 0.2 and 0.3.1 show this behaviour
    - PHP version of the server is 5.2.9

    The skin html (snippet from login.html) looks as follows;

    PHP Code:
    <img src="/images/<?php

    $getTLD 
    array_reverse(explode(".",$_SERVER['HTTP_HOST']));
    $getTLD $getTLD[1].".".$getTLD[0];
    echo 
    $getTLD;

    ?>.png" border="0"
    Yet for some reason the PHP doesn't get parsed. Am I missing something here?

  2. #2
    alec is offline Registered User
    Join Date
    Oct 2008
    Posts
    335
    Downloads
    1
    Uploads
    0

    Default

    Try this instead <roundcube:include file="file.php" />, you can also create a plugin to set some session variable, and then read it in a skin with <roundcube:var name="session:variablename" />

  3. #3
    forkless is offline Roundcube Newcomer
    Join Date
    Feb 2010
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default

    Hi Alec,

    Thanks for your quick response. I see what the config variable actually does now! (So much reading eh )

    Anyways, I created a getdomain.php file for the 0.2 release box and included the tag with the template I want to use it in. However that did not seem to work. For testing purposes I've included it out and inside of a tag which didn't seem to make any difference. Am I correct in thinking that when I invoked the include file relatively it will take the actual file from the active templates folder? If so that did not work.

    Next step was to try and point it to an absolute path. No difference either, unfortunately. So I'm a bit stumped at why it does not want to pick up the PHP bit.

    Will be trying this on the 0.3.1 release next. Will post the results in a bit. Well just tried 0.3.1 as well and doesn't seem to want to eat that include either. Hope somebody else (or you) may be able to shed some more light onto this.

    Thanks again for your input,
    fork
    Last edited by forkless; 02-10-2010 at 04:52 PM. Reason: Added results for 0.3.1

  4. #4
    skaero's Avatar
    skaero is online now Administrator
    Join Date
    Jun 2006
    Location
    USA - New Mexico
    Posts
    2,092
    Downloads
    5
    Uploads
    0

    Default

    The include path is relative to the skin folder <RC root>/skins/<skin name> so if you wanted the templates folder it would be /templates/<file> Just should how much we need skin documentation

  5. #5
    forkless is offline Roundcube Newcomer
    Join Date
    Feb 2010
    Posts
    5
    Downloads
    0
    Uploads
    0

    Talking Thanks xD

    Quote Originally Posted by skaero View Post
    The include path is relative to the skin folder <RC root>/skins/<skin name> so if you wanted the templates folder it would be /templates/<file> Just should how much we need skin documentation
    Sweet! That did the trick for me

    Thanks for both your efforts!

  6. #6
    forkless is offline Roundcube Newcomer
    Join Date
    Feb 2010
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by skaero View Post
    The include path is relative to the skin folder <RC root>/skins/<skin name> so if you wanted the templates folder it would be /templates/<file> Just should how much we need skin documentation
    I have one small question regarding nesting <roundcube> tags. When I add an include as shown below;

    PHP Code:
    <div id="header"><roundcube:button command="mail" image="/images/<roundcube:include file="/templates/getdomain.php" />.png" alt="Roundcube  Webmail" /></div
    I will get the following HTML output;

    PHP Code:
    <div id="header"><a href="./?_task=mail" onclick="return rcmail.command('mail','',this)"><img src="skins/default/images/<roundcube:include file=" id="rcmbtn104" alt="" /></a>.png" alt="Roundcube Webmail" /></div> 
    Apparently it does do a partial parse but then it gets killed (escaping problem maybe?)

    Now my question is are nested roundcube tags not supposed to work by design or did I stumble onto a bug?

  7. #7
    alec is offline Registered User
    Join Date
    Oct 2008
    Posts
    335
    Downloads
    1
    Uploads
    0

    Default

    It's not working by design.

  8. #8
    forkless is offline Roundcube Newcomer
    Join Date
    Feb 2010
    Posts
    5
    Downloads
    0
    Uploads
    0

    Default

    Cool, no problem. Good to know though -)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts