Jump to content

Theme Selector Image Display...


zigvt

Recommended Posts

I have this software that lets user's use themes and so on. But one feature they didn't add into the peice of code is image display of the theme before the person chooses. I was hoping someone could help me figure out what bit of code I need to make it work. I know joomla has this feature but I don't care for joomla and I like this script alot more. All I can offer is the code where it displays the theme selector.

 

PHP Part

 

	// HANDLE SUBMITTED DISPLAY SETTINGS //
if (isset($_POST["SubmitDisplay"])) {

	myQ("
		UPDATE `[x]users` 
		SET 
			`use_theme` = '{$_POST["theme"]}', 
		WHERE `id`='".me('id')."' 
		LIMIT 1
	");
}
/* Populate the site themes */
if ($handle = opendir("theme/")) {

	$themeInUse = (me("use_theme") != "" ? me("use_theme") : $CONF["DEFAULT_THEME"]);

	while (false !== ($file = readdir($handle))) {

		if ($file != "." and $file != ".." and $file != "templates" and is_dir("theme/".$file)) {
			$themesReplacementArray[] = array(
				"theme" => $file,
				"select" => ($file == $themeInUse ? "selected=\"selected\"" : ""),
			);
		}
	}
	closedir($handle);
}
$tpl -> Loop("themes", $themesReplacementArray);

 

HTML Part

			<form method="post">
		<table width="100%" border="0" cellspacing="2" cellpadding="0">
              <tr>
                <td><strong>Site style: </strong></td>
                <td width="10"> </td>
                <td>
			<select name="theme" id="theme">
			<loop themes>
			<option value="{theme}" {select}>{theme}</option>
			</loop themes>
                </select>				</td>
              </tr>
              <tr>
                <td colspan="3"><input name="SubmitDisplay" type="submit" class="submit" id="SubmitDisplay" value="Save" /></td>
                </tr>
            </table>
		</form>

 

Thanks in advance.

 

Link to comment
https://forums.phpfreaks.com/topic/226861-theme-selector-image-display/
Share on other sites

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.