Make a Lasting Impression
ImpressCMS Blog > How create a fancy Theme Select Block

How create a fancy Theme Select Block


A nice ImpressCMS feature is if you like users or visitors can select themes  But the classic Select Theme Block looks old and if you like play with modern select scripts or HTML5 there is a problem: template file (system_blocks_themes.html) has only one smarty var: <{$block.theme_select}>. All HTML code is in a core php file.

Well, let´s go change.

First edit /modules/system/blocks/system_blocks.php file and replace lines 593-600 with

$block = array();<br />&nbsp;&nbsp; &nbsp;$block['imagenes'] = $options[0];<br />&nbsp;&nbsp; &nbsp;if ($options[0] == 1) {<br />&nbsp;&nbsp; &nbsp;$block['imagenesruta'] =&nbsp; "" . ICMS_THEME_URL . "/" . $icmsConfig['theme_set'] . "/shot.gif" alt="screenshot" width="". (int) $options[1] . "";<br />&nbsp;&nbsp; &nbsp;} <br />&nbsp;&nbsp; &nbsp;$block['numero'] =&nbsp;&nbsp; sprintf(_MB_SYSTEM_NUMTHEME, count($icmsConfig['theme_set_allowed'])) ;<br />&nbsp;&nbsp; &nbsp;$block['opciones'] = $theme_options;<br />

We have now new smarty vars and can play with them in the template file.
    In /modules/system/templates/blocks/system_blocks_themes.html
    replace for
<p>&nbsp;&nbsp; &nbsp;<div style="text-align: center;"><br />&nbsp;&nbsp; &nbsp;<form action="index.php" method="post"><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<div><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<{if $block.imagenes}><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<img src="<{$block.imagenesruta}>" vspace="2" id="icms_theme_img" /><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<br /><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<select id="theme_select" name="theme_select" onchange="showImgSelected('xoops_theme_img', 'theme_select', 'themes', '/shot.gif',<{$icms_url}>)"><{$block.opciones}></select><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<input type="submit" value="<{$smarty.const._GO}>" /><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<{else}><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<select id="theme_select" name="theme_select" onchange="submit();" size="3"><{$block.opciones}></select><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<{/if}><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<p><{$block.numero}></p><br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;</div><br />&nbsp;&nbsp; &nbsp;</form><br /></div><br />

Clear cache

Now you can use mousewheel or fancy select scripts.
All posts by debianus
Subscribe to latest posts
The comments are owned by the poster. We aren't responsible for their content.
Poster Thread