×

Error

Please login first

Customizable profile template

17 years 7 months ago #21836 by illsbills
Replied by illsbills on topic Re:Customizable profile template
Hi,
I looked in the plugin API documentation, but I am not sure where and how to include the css file. Could you give me a hint?
Thanks,
ilya

Please Log in to join the conversation.

17 years 7 months ago #21870 by pointri
Replied by pointri on topic Re:Customizable profile template
Just typing aloud here, so to speak...

Looks like the template selector's wrapped into a custom head tag function in comprofiler.class.php (around line 1431):

[code:1]
function selectTemplate($ui) {
global $mosConfig_live_site, $ueConfig;

if ($ui==1) $templatedir=$ueConfig;
else $templatedir="luna";

return $mosConfig_live_site . '/components/com_comprofiler/plugin/templates/'.$templatedir.'/';
}
[/code:1]

Then there are two functions right after it that append the stylesheet to either the page header or where the component starts, depending on whether you need the page to be XHTML compliant or not...

[code:1]
function addCbHeadTag($ui,$text) {
global $mainframe, $ueConfig;
if ($ui==1 && method_exists($mainframe,"addCustomHeadTag"«») && isset($ueConfig) && $ueConfig) {
$mainframe->addCustomHeadTag($text);
} else {
echo $text;
}
}

function outputCbTemplate($ui) {
addCbHeadTag($ui, '<link type="text/css" rel="stylesheet" href="' . selectTemplate($ui) . 'template.css" />');
}
[/code:1]

Simple enough, but that selectTemplate() function is hard-coded to retrieve a particular template from the component's configuration, and not a user-defined field or parameter. That might make a plugin for controlling template output a little tricky without a core change.

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in to join the conversation.

17 years 7 months ago #21871 by mikko
Replied by mikko on topic Re:Customizable profile template
You can load CSS just about anywhere in an html document. For example make a plugin that outputs css with the getDisplayTab function and then publish the plugin to the top position.

mikko

Please Log in to join the conversation.

17 years 7 months ago #21873 by pointri
Replied by pointri on topic Re:Customizable profile template
Hmm...I was just thinking that...I guess the default templating from the core would be output before a plugin would, so just outputting a new stylesheet link from the plugin would override the previous one, right?

Post edited by: pointri, at: 2006/10/03 20:51

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in to join the conversation.

17 years 7 months ago #21877 by mikko
Replied by mikko on topic Re:Customizable profile template
You can use multile stylesheets google

css multiple stylesheets

to find out more.

mikko

Please Log in to join the conversation.

17 years 7 months ago #21880 by pointri
Replied by pointri on topic Re:Customizable profile template
Okay, so a little simpler of a task than I thought...well, except for that tedious task of making new templates that would follow.

Skribbling it down here...I can look more into it later...

[code:1]// Class, language and include niceities...

// Helper function writes posted user-defined custom template fields to #__comprofiler

_getDisplayTab($ui,$user) {

// Get user-defined fields from the select lists below

$CBtemplate = $user->customCBCSSfield;
$Jtemplate = $user->customJCSSfield;

$mainframe->addCustomHeadTag('<link href="' . $mosConfig_live_site . '/templates/'.$Jtemplate.'/CSS/template.css" rel="stylesheet" type="text/css"/>'

$out = '<link href="' . $mosConfig_live_site . '/components/com_comprofiler/plugins/templates/'.$CBtemplate.'/template.css" rel="stylesheet" type="text/css"/>'

$out .= '<link href="' . $mosConfig_live_site . '/components/com_comprofiler/plugins/templates/'.$CBtemplate.'/calendar.css" rel="stylesheet" type="text/css"/>'

return $out;

}

_getEditTab($ui,$user) {

$cb_tmpl_query = "SELECT name, folder FROM #__comprofiler_plugins WHERE type = 'templates' AND published = 1";
$database->setQuery($cb_tmpl_query);
$database->loadArray();

// Build into a select list

// Borrow code from the Joomla template chooser module...

// Submit

}[/code:1]

Building and storing users' custom CSS styles instead of selecting templates would obviously be much more involved.

Post edited by: pointri, at: 2006/10/02 17:58

Joomlapolitan zealot and a somewhat stealthy, rather passive CB3PD developer.
www.constructionlounge.com Construction Lounge: Online resource and networking portal for the construction and remodeling industries.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.187 seconds

Facebook Twitter LinkedIn