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
  #11  
Old 7th May 2013, 13:51
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,

I went ahead and added that ?id=1 to the end of the link open up the section. It did not place the value.

How do I set the template variable {tmpl_var name='id'}. Do I need to set this inside of my form configuration file? I am looking at the Interface config section because it is the most similar to what I am trying to do for this section.

I see that it sets the template variable id, but how is it getting that information? How can I do the same thing? I just need the ID set, and I think that I will have it all done. I can set it manually, but I don't think that is the right thing to do here.
Reply With Quote
Sponsored Links
  #12  
Old 7th May 2013, 15:17
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,046
Thanks: 826
Thanked 5,388 Times in 4,233 Posts
Default

Quote:
How do I set the template variable {tmpl_var name='id'}. Do I need to set this inside of my form configuration file? I am looking at the Interface config section because it is the most similar to what I am trying to do for this section.
The ID is set automatically based in the definition of the primary ID field in the form file.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #13  
Old 7th May 2013, 16:19
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default

It appears that ISPConfig did not like the field name that I used.

I had theme_settings_id. I changed the field to themesettings_id, and it magically works.

Till,

Thanks for the help. I appreciate it. I am not sure how mane people even use my theme, but this will make it better for those that do!
Reply With Quote
  #14  
Old 8th May 2013, 16:24
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,

I have everything almost completed in the backend, but this has led to more questions.

1. When you are using a datasource in a SELECT type field for the form, how can you have it save the value_field into the database. Right now, on save it is saving the value of the select as 0 or 1 or whatever. Can you set the value equal to the value that it displays in the select dropdown?

2. How do we do right template loops in ISPConfig3? Is it better to try to do it PHP and output the code in the template that way?
Reply With Quote
  #15  
Old 8th May 2013, 16:49
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,046
Thanks: 826
Thanked 5,388 Times in 4,233 Posts
Default

1) Sure. In the form file you can define which column is used for the value field, this can be the same column that you use for the displayed value.

2) Use the tmpl_loop statement in the template, no need for any manual programming in php.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #16  
Old 9th May 2013, 01:10
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default

Quote:
Originally Posted by till View Post
1) Sure. In the form file you can define which column is used for the value field, this can be the same column that you use for the displayed value.

2) Use the tmpl_loop statement in the template, no need for any manual programming in php.
Till,

Thanks. I have it saving the correct information to the database now! Now, I just have to figure out this front page.

I am trying to add a sidebar to the front page that output data from the database.

This is how I envision it working.

Category 1
---Stuff from First Item in Category 1
---Stuff Form Second Item in Category 1
Category 2
---Stuff from First Item in Category 2
---Stuff Form Second Item in Category 2

This is my current index.htm.

Code:
<aside id="sidebar" class="login-sidebar">
    {tmpl_loop name='sidebar_records'}
</aside>

<div id="login-form">
    <div class="box-inner">
        <img title="<tmpl_var name="app_title">" id="logo" alt="<tmpl_var name="app_title">" src="<tmpl_var name='app_logo'>">
        <table>
            <tbody>
                <tr>
                    <td class="title">
                        <label for="username">{tmpl_var name='username_txt'}</label>
                    </td>
                    <td class="input">
                        <input name="username" id="username" value="" size="30" maxlength="255" type="text" class="textInput"  onkeypress="if (event.keyCode && event.keyCode == 13) {submitLoginForm('pageForm'); return false;};" />
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        <label for="passwort">{tmpl_var name='password_txt'}</label>
                    </td>
                    <td class="input">
                        <input name="passwort" id="passwort" value="" size="30" maxlength="255" type="password" class="textInput"  onkeypress="if (event.keyCode && event.keyCode == 13) {submitLoginForm('pageForm'); return false;};" />
                    </td>
                </tr>
            </tbody>
        </table>
        <input type="hidden" name="s_mod" value="login" />
        <input type="hidden" name="s_pg" value="index" />
        <p id="loginbutton">
            <button type="button" class="button" value="{tmpl_var name="add_new_record_txt"}" onclick="submitLoginForm('pageForm');"><span>{tmpl_var name='login_button_txt'}</span></button>
        </p>
        <p class="powered">Powered by <a href="<tmpl_var name="app_link">" target="_blank"><tmpl_var name="app_title"></a></p>
    </div>
    <div class="box-bottom">
        <div id="message">
            <tmpl_if name="msg">
                <div id="OKMsg"><p><tmpl_var name="msg"></p></div>
            </tmpl_if>
            <tmpl_if name="error">
                <div id="errorMsg">
                    <div class="warning"><tmpl_var name="error"></div>
                    <br /><a href="#" onclick="loadContent('login/password_reset.php');">{tmpl_var name='pw_lost_txt'}</a>
                </div>
            </tmpl_if>
        </div>
    </div>
</div>
I have added this information to the login module.

Code:
$sidebar_records = array();
		$sidebar_query = $app->db->queryAllRecords("SELECT category,title,tpl_ispc_clean_app.desc,image_url,link,target FROM tpl_ispc_clean_app order by sorting ");
		if(is_array($sidebar_query)) {
			foreach($sidebar_query as $side_qry) {
				$sidebar_records[$side_qry['category']] = $side_qry['category'];
				$sidebar_records[$side_qry['title']] = $side_qry['title'];
				$sidebar_records[$side_qry['desc']] = $side_qry['desc'];
				$sidebar_records[$side_qry['image_url']] = $side_qry['image_url'];
				$sidebar_records[$side_qry['link']] = $side_qry['link'];
				$sidebar_records[$side_qry['target']] = $side_qry['target'];
			}
		}

$app->tpl->setVar('sidebar', print_r($sidebar_records));
$app->tpl->setLoop('sidebar_records', $sidebar_records);
I guess that I don't understand loops in the templates because nothing is happening. It is throwing out the error Invalid Loop Structure. Any help would be great!
Reply With Quote
  #17  
Old 10th May 2013, 17:13
dclardy dclardy is offline
Senior Member
 
Join Date: Sep 2009
Location: Dallas, TX
Posts: 347
Thanks: 10
Thanked 47 Times in 28 Posts
Default

Any ideas on this, Till?

I am pretty sure that you and Falko can help me here.
Reply With Quote
  #18  
Old 11th May 2013, 18:33
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,046
Thanks: 826
Thanked 5,388 Times in 4,233 Posts
Default

The way sou build the array for th loop looks wrong please check out the ispconfig files that build the menus for some working code. And the login module is just doing the user authentication, it is not writing ny menus or templates. So adding a menu thre oes not mke much sense for me.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #19  
Old 11th May 2013, 20:03
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,

I'll look at the code for the submenus. I guess the dashboard would be a good module to look at for that.

I am using the login module because I am adding a list of helpful links for customers on the login page. When I finish it, it will make perfect sense!
Reply With Quote
  #20  
Old 13th May 2013, 20:41
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.

I just wanted to say thanks for all the help. I have completed my little project, and I wanted to show it to you. I will be pushing out all of these changes to my theme later in the week.

The entire sidebar area is dynamically created. You can add as many links and categories as you want form the System Admin section.

Reply With Quote
The Following 2 Users Say Thank You to dclardy For This Useful Post:
till (13th May 2013), zool (18th May 2013)
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 16:31.


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