I'm trying to develop a theme that uses a dynamic stylesheet: style.php
In it, I would like to references some background-images ala:{code]' background: URL('.$imagepath.'/lr.gif) no-repeat bottom right;'."\n".
[/code]The problem is that $imagepath seems to be completely empty.
for that matter, so do $pagewidth, $lcolwidth and $rcolwidth.
the $colors arrays seems to be available however.
Any idea how to solve this issue?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
[solved] style.php & $imagepath
-
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
-
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
OK, I've corrected this problem.
The $pagewidth, etc vars seem to work now, but I'm not sure what has changed, so I can't explain it.
In order for the $imagepath to be available, I inserted the following at the top of style.php
Code
-
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
Please note that $imagepath is not available unless the theme is selected as your theme (or the default site theme). It cannot be accessed upon theme init or viewing from the theme listing in Xanthia. :(
Here's how I got around it: (this in style.php)
Code
function ch_getimagepath($skin)
{
$path = pnGetBaseURI();
$directory = 'themes/'.pnVarPrepForOS($skin).'/images';
if($path!='') $path.='/';
$imagepath=$path.$directory;
return $imagepath;
}
global $imagepath;
if ($imagepath == "") $imagepath = ch_getimagepath($skin); // imagepath not available on themeinit
if (substr($imagepath,0,1) <> "/") $imagepath = "/".$imagepath;
$stylesheet =
' background: url('.$imagepath.'/ur.gif) no-repeat top right;'."\n"; -
- Rank: Developer
- Registered: Jun 16, 2003
- Last visit: May 29, 2010
- Posts: 1966
I had to modify it a little more because the $imagepath is sometimes returned as the *current* imagepath and not the one for the theme being installed... so the bottom part of the code there should look like:
- Moderated by:
- Support
