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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
tmk
Forum Members
Forum Members
Posts: 25
Joined: Sun Sep 23, 2007 4:07 am

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

Post 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!
Last edited by tmk on Fri Jan 30, 2009 12:24 am, edited 1 time in total.
nhaack

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

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

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

Post 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...
tmk
Forum Members
Forum Members
Posts: 25
Joined: Sun Sep 23, 2007 4:07 am

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

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

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

Post by Dr.CSS »

Well I'm no programmer, HTML/CSS for me ;) but thanks...

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

Return to “Developers Discussion”