soddengecko Posted October 28, 2006 Share Posted October 28, 2006 hi alli am using a little script that pull the folder names from a given directory. these names are then outputted as URL's for the end user to choose which theme they wish to usehere is the codefunction gl_themechooser(){$handle=opendir('./themes');while ($file = readdir($handle)) {if ($file != "." && $file != ".." && $file="<a href=\"$PHP_SELF\">$file</a><br />\n") {echo "$file";}}closedir($handle);}the theme is displayed like so$sql = 'SELECT * FROM theme;';$result = mysql_query($sql) or die('');while ($row = mysql_fetch_assoc($result)){$filename = "themes/".$row['theme']."";if (file_exists($filename)) { include "themes/".$row['theme']."/sidebar.php";} else { include "themes/default/sidebar.php";}}}depending on the row in the mysql db depends on what theme is used.the trouble i am having is updatying that row depending on what URL is clicked. for some reason the variable keeps emptying when i tried using a form method and I cannot figure it out. anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/25396-theme-switching-and-updating-mysql-row/ Share on other sites More sharing options...
fenway Posted October 28, 2006 Share Posted October 28, 2006 I don't understand your question. Link to comment https://forums.phpfreaks.com/topic/25396-theme-switching-and-updating-mysql-row/#findComment-115896 Share on other sites More sharing options...
soddengecko Posted October 28, 2006 Author Share Posted October 28, 2006 sorry, maybe not enough infobasically i have a script that gets the folder names from my templates directory. these folder names are outputted as URL's in the theme choice section. How do i use those links to update the mysql database corresponding to the theme? i have managed now to do it with a form, but would prefer to use links so i can use a screen shot of the template to show which is being chosen.secondly, when the database row is empty, it does not default to the default theme, it just shows a blank page. this is the script i am using to show the themefunction gl_header(){$sql = 'SELECT * FROM theme;';$result = mysql_query($sql) or die('');while ($row = mysql_fetch_assoc($result)){$filename = "themes/".$row['theme']."";if (file_exists($filename)) { include "themes/".$row['theme']."/header.php";} else { include "themes/default/header.php";} }} Link to comment https://forums.phpfreaks.com/topic/25396-theme-switching-and-updating-mysql-row/#findComment-115946 Share on other sites More sharing options...
fenway Posted October 28, 2006 Share Posted October 28, 2006 Update it with what? Link to comment https://forums.phpfreaks.com/topic/25396-theme-switching-and-updating-mysql-row/#findComment-116076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.