Skip to Content Skip to Menu

CB RC2 Templates

  • Notexa
  • Notexa
  • OFFLINE
  • Posts: 14
  • Thanks: 0
  • Karma: 3
18 years 7 months ago #10266 by Notexa
Replied by Notexa on topic Re:CB RC2 Templates
beat wrote:

I'm watching this thread, and will read the code, and if needed, try to implement the needed events into 1.0 stable, so that a plugin can handle this :)


Thanks Beat ! I hope the code is clear enough.
I'll wait with the plugin until stable comes out.

[url=http://www.notexa.be/[/url]

Please Log in or Create an account to join the conversation.

  • beat
  • beat
  • ONLINE
  • Posts: 2169
  • Thanks: 463
  • Karma: 352
18 years 7 months ago #10459 by beat
Replied by beat on topic Re:CB RC2 Templates
Notexa wrote:

beat wrote:

I'm watching this thread, and will read the code, and if needed, try to implement the needed events into 1.0 stable, so that a plugin can handle this :)


Thanks Beat ! I hope the code is clear enough.
I'll wait with the plugin until stable comes out.


I've just checked how to do this, and added to 1.0 stable a new plugin API event "onBeforeUserProfileRequest", which gets fired at the very begin of any user profile request, and will allow you to execute your code right there, before the CB template is outputed. :)

Same event has other useful applications ;).

Thanks for your suggestion. Please continue sharing your excellent work on CB templating :)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in or Create an account to join the conversation.

  • Notexa
  • Notexa
  • OFFLINE
  • Posts: 14
  • Thanks: 0
  • Karma: 3
18 years 7 months ago #10464 by Notexa
Replied by Notexa on topic Re:CB RC2 Templates
beat wrote:
I've just checked how to do this, and added to 1.0 stable a new plugin API event "onBeforeUserProfileRequest", which gets fired at the very begin of any user profile request, and will allow you to execute your code right there, before the CB template is outputed. :)
[/quote]

Great news. I was lookig for that event to write a plugin.
And it's true, this opens up a lot of possibilities, not only for the templating system.

[url=http://www.notexa.be/[/url]

Please Log in or Create an account to join the conversation.

18 years 7 months ago #10490 by sephirothVR
Replied by sephirothVR on topic Re:CB RC2 Templates
beat wrote:

Notexa wrote:

beat wrote:

I'm watching this thread, and will read the code, and if needed, try to implement the needed events into 1.0 stable, so that a plugin can handle this :)


Thanks Beat ! I hope the code is clear enough.
I'll wait with the plugin until stable comes out.


I've just checked how to do this, and added to 1.0 stable a new plugin API event "onBeforeUserProfileRequest", which gets fired at the very begin of any user profile request, and will allow you to execute your code right there, before the CB template is outputed. :)

Same event has other useful applications ;).

Thanks for your suggestion. Please continue sharing your excellent work on CB templating :)


sure nice hearing that.... Now the onli thing is waiting 4 the stable version to be released............

Please Log in or Create an account to join the conversation.

18 years 7 months ago #10813 by sephirothVR
Replied by sephirothVR on topic Re:CB RC2 Templates
Notexa wrote:

I've managed to get a dynamic template per user.
It's still very alpha (meaning it are only code hacks nw) but I'm going to try to put it all in a plugin.

What did I do:

First I created a single dropdown field with the name cb_template. This field is populated with three values: dark, osx and webfx (just for testing purposes).
I'm going to put this in a plugin with a template preview.

Next I changed in comprofiler.class.php the function selectTemplate($ui):
Added to globals:
global $database, $my, $_REQUEST;

Right after the globals I added this:
if (ISSET($_REQUEST)) {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$_REQUEST;
} else {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$my->id;
}
$database->setQuery( $query );
$templates = $database->loadObjectList();
$template = $templates[0];
$templatedir=$template->cb_template;
if ($templatedir) $ueConfig=$templatedir;

Now each user has his own profile template. Users with no profile set get the default profile.
Anybody got an idea how I can add the changes to the selecttemplate function in a plugin ? I don't want to create a plugin that requires code hacks.

Post edited by: Notexa, at: 2006/04/13 12:50



Thanks ALOT. Tested just now. The code does works...... Like u said, i dont think its necessary to build a plugins, just hope beat put this code in his next stable released.....

Please Log in or Create an account to join the conversation.

  • beat
  • beat
  • ONLINE
  • Posts: 2169
  • Thanks: 463
  • Karma: 352
18 years 7 months ago #10815 by beat
Replied by beat on topic Re:CB RC2 Templates
sephirothVR wrote:

Notexa wrote:

I've managed to get a dynamic template per user.
It's still very alpha (meaning it are only code hacks nw) but I'm going to try to put it all in a plugin.

What did I do:

First I created a single dropdown field with the name cb_template. This field is populated with three values: dark, osx and webfx (just for testing purposes).
I'm going to put this in a plugin with a template preview.

Next I changed in comprofiler.class.php the function selectTemplate($ui):
Added to globals:
global $database, $my, $_REQUEST;

Right after the globals I added this:
if (ISSET($_REQUEST)) {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$_REQUEST;
} else {
$query="SELECT cb_template FROM #__comprofiler WHERE id = ".$my->id;
}
$database->setQuery( $query );
$templates = $database->loadObjectList();
$template = $templates[0];
$templatedir=$template->cb_template;
if ($templatedir) $ueConfig=$templatedir;

Now each user has his own profile template. Users with no profile set get the default profile.
Anybody got an idea how I can add the changes to the selecttemplate function in a plugin ? I don't want to create a plugin that requires code hacks.

Post edited by: Notexa, at: 2006/04/13 12:50



Thanks ALOT. Tested just now. The code does works...... Like u said, i dont think its necessary to build a plugins, just hope beat put this code in his next stable released.....


I have not put that code as is in next release. Only a plugin-event call.

The code as is is not universal, as it uses fixed field names.

I prefer much the plugin-approach, as it keeps the core simple and slick, while allowing multiple uses of the events provided.

Our core component is quite self-explaining to configure, and we would like to keep it so.

Anyway, stable is not far away anymore...

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum