I'm using some includes that I've written. So far, I seem to only be able to get them recognized by using paths like this one:
include ('/home/stanatsc/public_html/gal01/themes/defjam_exie/php_includes/slideshow_extra_functions.php');
Obviously, it would be MUCH better to use variables, but I can't seem to get them to work. For example, I've tried using $_zp_themeroot, but with no luck.
What is the proper syntax for doing this and what variables are recommended?
Thanks in advance!
Comments
`SERVERPATH`, `ZENFOLDER`, `PLUGIN_FOLDER`, and `THEMEFOLDER`
`$_zp_themeroot` should be setup for any script that is loaded by the zenphoto root index.php script. What are you finding with it?
What you actually have to use will depend on where the include is located. Standard OS file referencing applies, so if the script is in the same folder as the one to be included all you need is the script name. If the included script is in a subfolder then the path is «subfolder»/«script name», etc.
`$_zp_themeroot = WEBPATH . "/" . THEMEFOLDER . "/" . $ThemeName;`
Thanks in advance, and if this question is just too basic and stupid to answer, I totally understand.
What exactly are you tring to accomplish? Is all this happening in PHP scripts in your theme? Then you can use un-qualified filenames as acrylian has shown above.
-including files (residing in the theme folder) so that they'll work if i move them to another theme (so calling them via relative paths and/or THEMEFOLDER would be great)
-referencing images (also in the theme folder)
i haven't had much luck with the relative path approach, so i was hoping to use the THEMEFOLDER approach, but i think i must be using that variable incorrectly. i'll try to find it in another file and copy its use and see if i can accomplish this.
thanks for helping a php novice!
Theme
--images
----image1.jpg
--css
----style1.css
--scripts
----script1.php
--theme.php
--script2.php
Then from theme.php you can reference the other files as:
script2.php
css/style1.css
images/image1.jpg
from script1.php the references would be
../script2.php
../css/style1.css
../images/image1.jpg