View Website
20 posts by 6 authors in: Forums > CMS Builder
Last Post: July 14, 2008 (RSS)
By Djulia - December 22, 2007
I would like to obtain a specific value for : View Website >>
For example :
I have an editor (1) who has access to the folder News and another editor (2) which has access to folder FAQ.
It would be possible to give a different value for each editor?
Editor (1) : View Website >> == News
Editor (2) : View Website >> == FAQ
Thank you for your answer.
Djulia
Re: [Djulia] View Website
By Dave - December 22, 2007
A few options for you though. The simplest might be to create a publishedSections.html page with links to all the published sections. Then have the "view website" link point to that. That way all the CMS users could find their section.
The other would be the hack the /lib/menus/header.php file to show a different link based on the user. I could write some quick custom code up for you to do that if you wanted. But you'd have to re-apply it every time you upgraded or it would get overwritten.
Does either of those work for you? I think the first one would be the easiest, especially if you ever have a user who manages 2 sections.
Hope that helps! :)
interactivetools.com
Re: [Dave] View Website
By Djulia - December 22, 2007
Thank you for your answer.
And with a condition ?
For example :
<?php if editor == 'name2' ?>
url 1
<?php elseif editor == 'name2' ?>
url 2
<?php endif ?>
Thank,
Djulia
Re: [Djulia] View Website
By Dave - December 22, 2007 - edited: December 22, 2007
- open /lib/menus/header.php
- search for $SETTINGS['websiteUrl'] and replace with $viewUrl
- add this code somewhere above it:
<?php
$viewUrl = $SETTINGS['websiteUrl'];
$username = $CURRENT_USER['username'];
if ($username == 'admin') { $viewUrl = "http://www.google.com/"; }
if ($username == 'dave') { $viewUrl = "http://www.yahoo.com/"; }
?>
Let me know if that works for you. :)
Edit: Fixed code (added $ in front of username)
interactivetools.com
Re: [Dave] View Website
By Djulia - December 22, 2007
I tested :
<?php if ($CURRENT_USER['isMyname']): ?>
My url
<?php endif ?>
...but, that does not function. :(
Djulia
Re: [Dave] View Website
By Djulia - December 22, 2007
I have just tested your proposal, but I have the error :
Notice: Use of undefined constant username - assumed 'username' in ...
An idea ?
Thank you,
Djulia
Re: [Djulia] View Website
By Dave - December 22, 2007
<?php
$viewUrl = $SETTINGS['websiteUrl'];
$username = $CURRENT_USER['username'];
if ($username == 'admin') { $viewUrl = "http://www.google.com/"; }
if ($username == 'dave') { $viewUrl = "http://www.yahoo.com/"; }
?>
interactivetools.com
Re: [Dave] View Website
By Djulia - December 22, 2007
It is perfect !!! [:)]
Thank you,
Djulia
Re: [Dave] View Website
By Djulia - July 10, 2008
I have a suggestion.
It would be possible to add a field "View Site" (websiteUrl) in the section User Accounts ?
It would be then possible to use a condition in header.php :
<?php if ($CURRENT_USER['websiteUrl']): ?>
<a href="<?php echo $CURRENT_USER['websiteUrl'] ?>"><?php _e('View Website >>') ?></a>
<?php elseif ($SETTINGS['websiteUrl']): ?>
<a href="<?php echo $SETTINGS['websiteUrl'] ?>"><?php _e('View Website >>') ?></a>
<?php endif ?>
Thank you for your answer.
Djulia
Re: [Djulia] View Website
By kevbarker - July 10, 2008
Thanks,
Kevin