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
Share on other sites

  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.