Posted on: 02/25/08 10:17pm
By: chemdata
I recently upgraded from 1.4.0 to 1.4.1. When I looked at the menuitems at the top I noticed that the link to "Gallery" was no longer there. I can bring it up by hard coding it into the header.thtml file. However, I wanted to use the lib-custom.php and config.php files to accomplish this since I thought I would be needing more links to and this would make it easier. I have serach and read posts in this forum some which were identical to my situation but I was unable to resolve my situation. I am sure that the problem is not with GeekLog but at my end. Evidently I just cannot resolve it. Any help is appreciated. Thanks. The following is the code I have in the respective files and I am using the Professional Theme.
header.thtml
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{allowed_menu_elements}{plg_menu_elements}</b></td>
</tr>
config.php
$_CONF['allowed_menu_elements'] = array
(
'home', // link to homepage
'contribute', // contribute / "submit a story" link
// 'calendar', // link to the site calendar
//'search', // link to advanced search
'stats', // link to site stats
'directory', // link to list of past stories
//'prefs', // link to user's preferences
// 'polls', // link to past polls
'plugins', // links added by plugins, like {plg_menu_elements}
'custom' // for custom links (see lib-custom.php)
//'account information' //
);
lib-custom.php
function CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
$myentries = array ();
// Sample link #1: Link to Gallery
$myentries[] = array ('url' => $_CONF['site_url'] . '/forensic/gallery/index.php/',
'label' => 'Gallery'
;
// Sample link #2: Link to the Personal Calendar - only visible for
// logged-in users
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) {
$myentries[] = array ('url' => $_CONF['site_url']
. '/calendar/index.php?mode=personal',
'label' => 'My Calendar'
;
}
return $myentries;
}
Re: Gallery Menu Link Not Showing
Posted on: 02/25/08 11:19pm
By: suprsidr
which gallery are you using?
-s
Re: Gallery Menu Link Not Showing
Posted on: 02/25/08 11:58pm
By: chemdata
My apologies. I am using 1.5.3 version of gallery.
Re: Gallery Menu Link Not Showing
Posted on: 02/26/08 07:35am
By: suprsidr
Yeah, I don't believe G1 actually registers as a plugin.
As for your custom menu entries, that looks correct to me.
Have you cleared your cache?
-s
Re: Gallery Menu Link Not Showing
Posted on: 02/26/08 01:46pm
By: Dirk
Make sure the function function CUSTOM_menuEntries() is not commented out (it is in the default lib-custom.php).
bye, Dirk
Re: Gallery Menu Link Not Showing
Posted on: 02/26/08 02:42pm
By: chemdata
Yes, I cleared the cache numerous times.
I also made sure the function CUSTOM_menuEntries () was not commented out in the default lib-custom.php as this was the one error that you consistently pointed out to many posters with this problem. Here is the way it reads with only the upper part being commented out.
/**
* This is an example of a function that returns menu entries to be used for
* the 'custom' entry in $_CONF['menu_elements'] (see config.php).
*
*/
function CUSTOM_menuEntries ()
{
global $_CONF, $_USER;
$myentries = array ();
// Sample link #1: Link to Gallery
$myentries[] = array ('url' => $_CONF['site_url'] . '/gallery/index.php',
'label' => 'Gallery';
// Sample link #2: Link to the Personal Calendar - only visible for
// logged-in users
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) {
$myentries[] = array ('url' => $_CONF['site_url']
. '/calendar/index.php?mode=personal',
'label' => 'My Calendar';
}
return $myentries;
}
I should have also pointed that here is what I get for the menuitems on the page:
Contribute | Advanced Search | Site Statistics | Directory | Crime Laboratory News | Links | Polls | Forum | Calendar
However in my config.php file I had not commented out home which appeared and had commented out search which did appear. Again thanks for the help. I keep hoping its just some stupid error on my part that can be easily found.
Re: Gallery Menu Link Not Showing
Posted on: 02/26/08 02:59pm
By: Dirk
Quote by: chemdata$_CONF['allowed_menu_elements'] = array
Missed this one. That should be
Text Formatted Code
$_CONF['menu_elements'] = array
without the "allowed_".
bye, Dirk
Re: Gallery Menu Link Not Showing
Posted on: 02/26/08 07:36pm
By: chemdata
I made the change in the lib-custom.php to $_CONF['menu_elements'] = array. I then went and played around with the header.thtml file to the following lines :
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{allowed_menu_elements}{plg_menu_elements}</b></td></tr>
making different combination of the {allowed_menu_elements}, {menu_elements} and{plg_menu_elements}. The only combination that gave me close to what I wanted but without the Gallery link was:
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{allowed_menu_elements}{plg_menu_elements}</b></td></tr>
I get the following menu when I am logged in:
Home | Contribute | Site Statistics | Directory | Crime Laboratory News | Links | Polls | Forum | Calendar
I get the following menu when I am NOT logged in:
Home | Crime Laboratory News
If I used {menu_elements}{plg_menu_elements} or {menu_elements} the Gallery link did show up as shown below.
=================================================================================
When I have the following code in header.thtml :
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{menu_elements}{plg_menu_elements}</b></td></tr>
I get the following menu when I am logged in:
Home | Contribute | Site Statistics | Directory | Crime Laboratory News | Links | Polls | Forum | Calendar | Gallery | My Calendar Crime Laboratory News | Links | Polls | Forum | Calendar
I get the following menu when I am NOT logged in:
Home | Contribute | Site Statistics | Directory | Crime Laboratory News | Crime Laboratory News
=================================================================================
When I have the following code in header.thtml :
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{menu_elements}</b></td></tr>
I get the following menu when I am logged in:
Home | Contribute | Site Statistics | Directory | Crime Laboratory News | Links | Polls | Forum | Calendar | Gallery | My Calendar
I get the following menu when I am NOT logged in:
Home | Contribute | Site Statistics | Directory | Crime Laboratory News
=================================================================================
Thanks for the help thus far.
Re: Gallery Menu Link Not Showing
Posted on: 02/27/08 03:30am
By: chemdata
I am trying to hardcode the Gallery link into the header.thtml file. I was using javascript similar to what was use in the lib-custom.php since I only want it to show if the user is logged in.
<script type="text/javascript">
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1))
{
document.write("<b><a class='header-navigation' href='http://www.mydomain/gallery/index.php'>Gallery</a></b>"
}
else
{
document.write(" "
}
</script>
Unfortunately this did not work. Is there an alternative to
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) which I can use in the javascript? Thanks.
Re: Gallery Menu Link Not Showing
Posted on: 02/27/08 02:28pm
By: Dirk
Sorry, but I'm not sure what you are trying to accomplish. Why the JavaScript?
bye, Dirk
Re: Gallery Menu Link Not Showing
Posted on: 02/27/08 06:09pm
By: chemdata
I am trying to make sure that the Gallery link only appears when the user is logged in and not just a guest browsing the website. I am using javascript because when I took the portion of the lib-custom.php file which dealt with the gallery and tried using it in the head.thtml as below and it didn't work for me.
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{allowed_menu_elements}{plg_menu_elements}</b>
<?php
{
global $_CONF, $_USER;
$myentries = array ();
// Sample link #1: Link to Gallery
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) {
$myentries[] = array ('url' => $_CONF['site_url'] . '/gallery/index.php',
'label' => 'Gallery';
}
}
?>
</td></tr>
I then tried its as javascript as below but that didn't work either. I thought it might have to do with the
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1)) and was looking for an equivalent to use.
<tr><td colspan="2" valign="bottom" bgcolor="#406E9B"><img src="{layout_url}/theme-images/pixel.gif" alt="" height="20" width="8" align="absmiddle" border="0">{allowed_menu_elements}{plg_menu_elements}</b>
<script type="text/javascript">
if (!empty ($_USER['uid']) && ($_USER['uid'] > 1))
{
document.write("<b><a class='header-navigation' href='http://www.mydomain/gallery/index.php'>Gallery</a></b>"
}
else
{
document.write(" "
}
</script>
</td></tr>
I hope I am expressing myself well enough but if not please let me know and I will try again. Thanks for the help.