Lahuindai wrote:
Firstly the Creation Process or method.install.php:
- I have created all the preferences for the system. There are sections in these and i would like to display them in tabs in the admin section. However these preferences will change in the future and for clients depending on requirements. How can i automagically create the tabs when it loads up in admin | is there an easy way or am i doing a smarty study

?
Maybe something like this in action.defaultadmin.php:
Code: Select all
// The tabs
echo $this->StartTabHeaders();
$active_tab = isset($params['active_tab']) ? $params['active_tab'] : FALSE;
// Only show thecategories tab if the 'showcategoriestab' pref is set to 1
if ($this->GetPreference('showcategoriestab', 1))
{
echo $this->SetTabHeader('categories', $this->Lang('categories'), ('categories' == $active_tab));
}
// Only show the template tab if the 'showtemplatetab' pref is set to 1
if ($this->GetPreference('showtemplatetab', 1))
{
echo $this->SetTabHeader('templates',$this->Lang('Templates'), ('templates' == $active_tab));
}
if($this->CheckPermission('Modify Site Preferences'))
{
echo $this->SetTabHeader('options', $this->Lang('options'), ('options' == $active_tab));
}
echo $this->EndTabHeaders();
echo $this->StartTabContent();
// Only show thecategories tab if the 'showcategoriestab' pref is set to 1
if ($this->GetPreference('showcategoriestab', 1))
{
echo $this->StartTab('categories', $params);
// Category tab code here
echo $this->EndTab();
}
// Only show the template tab if the 'showtemplatetab' pref is set to 1
if ($this->GetPreference('showtemplatetab', 1))
{
echo $this->StartTab('templates', $params);
// Template tab code here
echo $this->EndTab();
}
echo $this->EndTabContent();
Lahuindai wrote:
- Do i create the default templates in the templates directory and load them into the database on the creation ? what are the pros and cons ?
If template wil need to be edited, then I would load them into the database. You can see an example of multiple templates being loaded into the database in the Album module. However, sometime I plan to make Album only load the default template template into the database and allow the other extra templates to be installed into the database from files. You can see the MenuManager module for an example of this.
If the templates will not need to be edited, then I would just process them from a file with something like:
Code: Select all
echo $this->ProcessTemplate('sometemplate.tpl');
That code assumes the 'sometemplate.tpl' file is in the templates directory.
If you have any more questions, check out the #cms channel on irc.freenode.net or just post back here.
Hope this helps,
Elijah