Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Developers' Forum

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd May 2013, 05:46
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default Questions about adding settings in Admin Section

I know the thread title is a little broad, but I have a couple of questions about adding a section to the Admin section for a theme.

I would like to add some settings for my theme inside of the admin section of ISPConfig3. I was unable to get it to add dynamically so I had to hard code it for now. How can I get this to be added dynamically? Does the logic to check for admin.module.conf work in the theme folders as well?

It appears that it does, and I want to be sure that I am correct in that assumption.

The next question that I have is this, How do you query records from the database? This is the code that I am trying to use.

Code:
$logo = $app->db->queryOneRecord('SELECT logo_url FROM tpl_ispc_clean');

$form["tabs"]['basic'] = array (
	'title' 	=> "Basic Settings",
	'width' 	=> 80,
	'template' 	=> "templates/tpl_ispc-clean_basic.htm",
	'fields' 	=> array (
	##################################
	# Beginn Datenbankfelder
	##################################
		'logo_url' => array (
			'datatype'	=> 'VARCHAR',
			'formtype'	=> 'TEXT',
			'validators'=> '',
			'default'	=> '',
			'value'		=> $logo,
			'separator'	=> '',
			'width'		=> '40',
			'maxlength'	=> '255'
		),
        'sidebar_state' => array (
			'datatype'	=> 'INTEGER',
			'formtype'	=> 'TEXT',
			'validators'=> '',
			'default'	=> '',
			'value'		=> $sidebar_state,
			'separator'	=> '',
			'width'		=> '40'
		),
	##################################
	# ENDE Datenbankfelder
	##################################
	)
);
On my template file, I am calling that field, but it is not working.

Code:
<h2><tmpl_var name="tpl_ispc-clean_head_txt"></h2>
<p><tmpl_var name="tpl_ispc-clean_desc_txt"></p>

<div class="panel panel_system_config">
    
    <div class="pnl_formsarea">
        <fieldset class="inlineLabels"><legend>Basic Settings</legend>
            <div class="ctrlHolder">
                <label for="logo_url">{tmpl_var name='logo_url_txt'}Logo URL</label>
                <input name="logo_url" id="logo_url" value="{tmpl_var name='logo_url'}" size="50" maxlength="255" type="text" class="textInput" /> 152x46px
            </div>
            <div class="ctrlHolder">
                <label for="sidebar_state">{tmpl_var name='sidebar_state_txt'}Sidebar</label>
                <select class="selectInput" id="sidebar_state" name="sidebar_state">
                    <option value="0">Off</option>
                    <option value="1">On (Static)</option>
                    <option value="2">On (Retractable)</option>
                </select>
            </div>
        </fieldset>
        <input type="hidden" name="id" value="{tmpl_var name='id'}">
        <div class="buttonHolder buttons">
            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onclick="submitForm('pageForm','admin/tpl_ispc-clean.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onclick="loadContent('admin/server_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
        </div>
    </div>
    
</div>
Right now, I am placing all of this inside of the admin module of ISPConfig3, but it appears that I can load this all from the theme. Is that correct? I would love to keep it there, if possible. I do not like making people have to copy files install ISPConfig3 directories.

Any help would be appreciated. I am just trying to make the theme that I created a little better than it currently is.
Reply With Quote
Sponsored Links
  #2  
Old 2nd May 2013, 07:27
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default

After more investigation, I can't load it from the theme file. I guess that you can, but you have to make some changes to the requires stuff that it is kind of silly. ../../../../ It gets to be a lot after a few of those.

The menu is created from the admin->lib->menu.d-> directory. This can not be included in your theme.

I was unable to figure out how to write that query. If someone could help with that, I would be very glad. I am learning PHP so it is taking me a lot longer than it probably should to figure this out.
Reply With Quote
  #3  
Old 2nd May 2013, 12:58
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,457
Thanks: 813
Thanked 5,230 Times in 4,099 Posts
Default

Quote:
Does the logic to check for admin.module.conf work in the theme folders as well?
No and thats intended as themes may not contain own form files or meny entries.

Quote:
but it appears that I can load this all from the theme.
No. Themes may not contain php files. Themes may only contain css files, images and form files.

There is a strict separation between code files which contain programming logic, they have to be placed inside the module folders and themes which contain only style and template files.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #4  
Old 2nd May 2013, 13:43
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default

Till,

Thanks for the information. I will include all the files in the admin section.

Can you help me with the query listed above? I am trying to pull a single value from a table I created. I don't see any examples of that inside of the code, and am kind of a beginner at PHP.
Reply With Quote
  #5  
Old 3rd May 2013, 20:42
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,457
Thanks: 813
Thanked 5,230 Times in 4,099 Posts
Default

Replace the line:

'value' => $logo,

with:

'value' => $logo['logo_url'],
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #6  
Old 3rd May 2013, 22:21
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default

Till,

Thanks for that information. How do I get this to become a variable in the template? I am trying to load the value inside of the .htm file.

Once I get this one done, I am sure that I will be able to figure the rest of them out.

Are there any places to go for templating help?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Being Spammed/Hacked/Probed not sure PLEASE HELP! kresser General 10 29th October 2010 17:25
Can't access to my website - after install problem pallermo Installation/Configuration 18 4th June 2010 13:29
can't make work joomla + sef + .htaccess bochenn General 9 4th April 2007 13:47
Can't access System config / Settings section Spektro Installation/Configuration 1 9th December 2005 15:31
General ISPConfig Newbie Questions christopher Installation/Configuration 1 24th November 2005 09:54


All times are GMT +2. The time now is 22:56.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.