Roundcube Community Forum

 

Parsing PHP in skins

Started by forkless, February 10, 2010, 03:41:17 AM

Previous topic - Next topic

forkless

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;


<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?

alec

Try this instead , you can also create a plugin to set some session variable, and then read it in a skin with

forkless

#2
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

SKaero

The include path is relative to the skin folder /skins/ so if you wanted the templates folder it would be /templates/ Just should how much we need skin documentation :)

forkless

Quote from: skaero;25418The include path is relative to the skin folder /skins/ so if you wanted the templates folder it would be /templates/ Just should how much we need skin documentation :)

Sweet! That did the trick for me :D

Thanks for both your efforts!

forkless

Quote from: skaero;25418The include path is relative to the skin folder /skins/ so if you wanted the templates folder it would be /templates/ Just should how much we need skin documentation :)

I have one small question regarding nesting tags. When I add an include as shown below;

<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;

<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?

alec

It's not working by design.

forkless

Cool, no problem. Good to know though -)