I am using a cms called webspell and i am trying to make a custom theme / theme mod. My php experience is minimal so i need help rewriting a piece of code, here is it;
Basically that code will call on the .html template files for users from the root/templates folder. What i am trying to do is get it to look for the template files in the root/themes/$activetheme/templates directory, and if the file is not located there it will then look for it in the root/templates directory. Is this possible and if so can someone rewrite that segment of code to do this (for users not admin), thanks!
I am not sure how much coding this requires (or if its possible) but if is a bit more involved than i am thinking i can pay what it is worth through paypal.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
I am not sure if that code is actually doing what i need. The templates folder is root/templates/ by default. I want it to look for templates files inside of root/themes/$activetheme/templates/ and if it does not find the file located there it will then load the one that is in root/templates/
Is this in any way related to the use of $calledfrom or no?
Edit:
No it won't, that has just the purpose of changing directory. You can actually get around that, but we won't get into that right now.
Change like so:
PHP Code:
function gettemplate($template,$endung="html", $calledfrom="root")
{
global $activetheme;
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Got another for ya, this is the code i added to the admin panel to allow the user to change the activetheme;
PHP Code:
<tr>
<td align="right"><input type="text" name="activetheme" value="<?php echo $ds['activetheme']; ?>" size="15" onmouseover="showWMTT('id44')" onmouseout="hideWMTT()" /></td>
<td><b>Active Theme</b> <i>(make sure the theme is inside the /themes folder and put the exact theme folder name here without slashes(Example: default)</i></td>
</tr>
How can i make that option a drop down with a list showing every folder inside of root/themes/ that way we can avoid the whole typo issue i foresee happening.
Lets wing it. Man I miss my PC :'(
I'll just stick with the tables here:
PHP Code:
<tr>
<td align="right"><select name="activetheme">
<?php
$di = new DirectoryIterator('/root/themes');
foreach ($di AS $file)
{
if ($file->isDir() && !$file->isDot())
{
sprintf('<option value="%s">%s</option>' . PHP_EOL, $file->getFileName(), $file->getFileName());
}
}
?>
</select></td>
<td><b>Active Theme</b> <i>(make sure the theme is inside the /themes folder and put the exact theme folder name here without slashes(Example: default)</i></td>
</tr>
Yeah, something like that; you'll need to readd you're js calls though, I don't know what they do so I don't know if you'll need them / can use them. If you don't have DirectoryIterator, someone else will show you how to do it with a filescan or glob call.
I gotta go home now
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Neither of those is working, this one seems close, is it pulling the options from the folders inside of root/themes/ ?
You would need to write: print Theme_Folders('themes/','Current Theme Name');
And then the current theme name would be defined from your database from the row of the user.
it looks inside the defined folder path and calls out the folder names into and array to be put into a foreach function which creates the html options for the select box it works 100% because it was tested.