e107help.org Q&A
0 like 0 dislike

I am working on a custom theme, I am working on adding a section to allow the admin to change the logo size in admin area -> theme manager -> preferences. Currently they can chose from 30 (which is the default) and up to 70.

 

In the theme shortcode I have where it calls the preference down for the height and have it coded in like this

 

    function sc_bootstrap_branding()
    {
        $pref = e107::pref('theme', 'branding');
        $prefh = e107::pref('theme', 'brandingh');

        switch($pref)
        {
            case 'logo':

                return e107::getParser()->parseTemplate('{SITELOGO: h='.$prefh.'}',true);

            break;

            case 'sitenamelogo':

                return "<span class='pull-left'>".e107::getParser()->parseTemplate('{SITELOGO: h='.$prefh.'}',true)."</span>".SITENAME;

            break;

            case 'sitename':
            default:

                return SITENAME;

            break;
        }

    }

 

It is a simple, added the $prefh calling for the preference then inputting it into the spot where the number 30 was at. The issue is that since I did that the logo does not change in the height - idk if it is becaise I have it being stored as an arrey or what,

In the theme_config.php I added this to the code:

$var[1]['html']     = $frm->select('brandingh', array('30', '40', '50', '60', '70'), e107::pref('theme', 'brandingh', '30'));

Any idea how to get this to work?

e107 version e107 version 2.0
in Themes by (459 points) 17 37 50
Update: The issue isn't with the theme shortcode, In phpmyadmin I notice that in the branding it is set as 0 when it should be 30, and looking on the site with Firebug it displays the HTML code for the height is Arraypx; so it isn't getting the info right or something idk I cant think lol

1 Answer

0 like 0 dislike

The issue was in the theme_config.php

I had this for the code ~

$var[1]['html']     = $frm->select('brandingh', array('30', '40', '50', '60', '70'), e107::pref('theme', 'brandingh', '30'));

When I should of had something like this ~

$var[1]['html']     = $frm->text('brandingh', e107::pref('theme', 'brandingh', '30'));

Updated to this (from text to number)

$var[1]['html']     = $frm->number('brandingh', e107::pref('theme', 'brandingh', '30'));

by (459 points) 17 37 50
996 questions
1,389 answers
2,527 comments
2,512 users