Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 07:01 AM
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 06:41 AM
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 06:27 AM
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 01:29 AM
- mdee created topic »How to implement returnpage ?« 01:00 AM
- nestormateo responded to »Fillters in Clip« 24. May
- damon responded to »Can the Updated Version Check be Turned Off (Z 1.3)« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Convert uid to username - in template or code?
-
**unknown user**
- Rank: Senior
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 2330
I've got the uid passing to a template and was wondering if there was a pnRender tag to convert it to an actual username...or should I just do it before the template and assign it? -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
John,
You can do it either way (both are similar).
PHP - $pnRender->assign('uname', pnUserGetVar('uname', $uid));
template -
-Mark
--
Visit My homepage and Zikula themes. -
**unknown user**
- Rank: Senior
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 2330
Where is the best place to go for docs on pnRender tags...straight to the Smarty help? ...or is there something more nuke-specific? -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
In addition to the Smarty docs there's these which are linked from docs.postnuke.com. This is the documentation for .750 but will be updated shortly for .760 as there are some new and a few updated tags.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
IMO it's best to pass the username to the template as a parameter and reference it by something obvious like
I keep forgetting in the things I code that the aim of templating is seperation of the display stuff and the code, and so I personally think that the less 'code' in templates, the better.
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
HammerHead
IMO it's best to pass the username to the template as a parameter and reference it by something obvious like
I keep forgetting in the things I code that the aim of templating is seperation of the display stuff and the code, and so I personally think that the less 'code' in templates, the better.
It depends... The trade off is that you're deciding that it's the username that should be displayed here. What if the site admin would prefer the real name displayed?
We can't use the pnusergetvar plugin with only the username. The compromise is to assign both your choice (as the developer) and the user id.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
Personally I'd assign most of the variables I used in the function to the template. If a designer wants to radically redesign the template they'll want all the variables available to use.
Obviously, in an ideal situation, where you knew exactly what you wanted you wouldn't do this.
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide -
- Rank: Expert
- Registered: Nov 23, 2003
- Last visit: Dec 13, 2009
- Posts: 1487
I've found modules/pnRender/plugins to be a veritable treasure trove of functionality... mind the ones marked legacy.
What i noticed even earlier today, is that there is a very slight performance hit for using smarty/pnRender over assigning the variable... like .02-3 secs every 4 out of 10 or so. Negligable, but it'll add up.
Decisions decisions...
--
Under Construction! -
- Rank: Team Member
- Registered: Mar 18, 2002
- Last visit: Oct 21, 2009
- Posts: 6606
While there is the slight performance hit this is only when the template is executed. Don't forget that Smarty is designed as a caching template engine.
Running .760 on my site i've got xanthia's full page caching enabled and have not found anything (for my small site) that i've needed to exclude from caching. There's a little bit of additional code in .760's xanthia (and now .750b) that checks for the post array having some content (a form submission) and will clear the cache for that module. In .760 (but not .750b) the logic also clears the cache for any hooked modules.
-Mark
--
Visit My homepage and Zikula themes. -
- Rank: Legend
- Registered: Dec 11, 2002
- Last visit: Oct 21, 2009
- Posts: 11674
Quote
Running .760 on my site i've got xanthia's full page caching enabled and have not found anything (for my small site) that i've needed to exclude from caching.
Although it is possible to run something as dynamic as a forum using Xanthia's full page cache (I did this over at www.eurojamlive.org) you'll find that the 'latest post' indicators on PNphpBB are not refreshed as the index page of PNphpBB never receives POST content. Instead, you'll need to wait for the cache to expire.
--
itbegins.co.uk - Zikula Consulting
birtwistle.me.uk - Personal Blog
Please read the Support Guide
- Moderated by:
- Support
