Page 1 of 1

[solved] Eliminate -> syntax with UDT or GBC or Plugin

Posted: Tue Jan 13, 2009 4:39 pm
by tmk
In using the CustomContent module, the one problem I'm up against is that using  {if $ccuser->loggedin() }  on a page, makes it impossible to use a WYSIWYG editor for the page since it mangles the right arrow into its html equivalent, thus breaking the functionality.

Would it be possible to wrap the $ccuser->loggedin() in a UDT or GCB so that I could use  a WYSIWYG editor ?

Thanks!

Re: Eliminate -> syntax with UDT or GBC or Plugin

Posted: Tue Jan 13, 2009 5:30 pm
by nhaack
That is stuff that should go into your template... not the content block... as the name said, content blocks are for content ;) It'll make your life a lot easier

Best
Nils

Re: Eliminate -> syntax with UDT or GBC or Plugin

Posted: Tue Jan 13, 2009 5:43 pm
by Dr.CSS
I did this for a site, the custom content was so you had to login to get the distributors discount, and every time the editor made changes to page content it munged the code so I put it in a GCB and call it in page now all works fine...

[solved] Eliminate -> syntax with UDT or GBC or Plugin

Posted: Thu Jan 29, 2009 3:38 am
by tmk
Better than in a GCB, I made a UDT wrapper.

Code: Select all


// UDT name: FeUserLoggedIn

global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
$userloggedin = $feusers->LoggedIn();
$username = $feusers->LoggedInName();
$userid = $feusers->LoggedInId();
$useremail = $feusers->LoggedInEmail();

$gCms->smarty->assign('feuserloggedin', $userloggedin);
$gCms->smarty->assign('feusername', $username);
$gCms->smarty->assign('feuserid', $userid);
$gCms->smarty->assign('feuseremail', $useremail);

// in your page content. first make a call to the UDT to set the smarties
// {FeUserLoggedIn}
// then you can use:

// {if $feuserloggedin } 
// protected content
// {/if} 

// you also have access to any other FEU value you've smartied

So now I don't have to worry about the Wysiwig editor eating my protection logic.

TMK

Re: Eliminate -> syntax with UDT or GBC or Plugin

Posted: Thu Jan 29, 2009 6:56 pm
by Dr.CSS
Well I'm no programmer, HTML/CSS for me ;) but thanks...

please to mark first post as [solved]...