Unpublish template menu for landing pages

Feel free to talk about everything related to our Joomla Products
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Tue Feb 07, 2012 2:42 pm
Given the importance of using landing pages in relation to marketing, please consider creating a feature built into your templates that have top menus where one could unpublish the top menu somehow on certain content pages, i.e., landing pages that payoff marketing campaigns. It is a recommended "best practice" to not have any menus or other navigation on landing pages to distract from the core action directed at the visitor.

I know that if the menu was a module, one could unpublish it from that page, but in AppSite, and probably other templates Gavick makes, the mainmenu module is already unpublished by default as is the topmenu module, yet the menu in the template always displays across the top.

If there is already a solution that would work for disabling the mainmenu on landing pages, please let me know.

Thanks,
railer
User avatar
Gold Boarder

GK User
Tue Feb 07, 2012 3:05 pm
Hi Railer,

As of now, menu module is actually a block loaded default by template which can be called as a built-in feature in the other way.

In order to un-load it, we just need to remove this block out of template layout, I can't give you exact solution now because it would be different from templates. Just let me know which template you are using then I will show you a solution.

I also will ask our developers to consider to make the menu modulable.

Thanks,
User avatar
Platinum Boarder

GK User
Tue Feb 07, 2012 3:24 pm
Hi Don,

Thanks for your reply. As I mentioned in my original post, the template I'm using is AppSite. Right now I'm using the J1.5 version, but I'll be upgrading it to the 2.5 version soon, so please provide a solution for both template versions.

Thank you!

Railer
User avatar
Gold Boarder

GK User
Tue Feb 07, 2012 3:29 pm
Btw, if I were to modify the layouts/blocks/nav.php file to define an array of content item IDs and then create an if statement as follows to restrict the display of the mainmenu block on certain content items, would that work?

Code: Select all
<?php

// Here you can modify the navigation of the website

// No direct access.
defined('_JEXEC') or die;

?>

<?php $items = array(53,54) ; // 53, 54 is the value of the ItemId ?>
<?php if ( !in_array((int)JRequest::getVar('Itemid'),$items) ) : ?>

<div id="gkMainNav" class="gkWrap clear">
   <div id="gkMenu">
      <?php
         $this->menu->loadMenu($this->getParam('menu_name','mainmenu'));
          $this->menu->genMenu($this->getParam('startlevel', 0), $this->getParam('endlevel',-1));
      ?>
   
      <?php if($this->generateSubmenu && $this->menu->genMenu($this->getParam('startlevel', 0)+1, $this->getParam('endlevel',-1), true)): ?>
      <div id="gkSubmenu">
            <?php $this->menu->genMenu($this->getParam('startlevel', 0)+1, $this->getParam('endlevel',-1));?>
      </div>
      <?php endif;?>
   </div>
</div>

<?php endif; ?>


Please let me know...

Thanks,
railer
User avatar
Gold Boarder

GK User
Tue Feb 07, 2012 3:31 pm
I'm having trouble with downloading both versions of the template to check for you, please be patient I will get back with solution soon!
User avatar
Platinum Boarder

GK User
Wed Feb 22, 2012 12:50 am
Don Lee wrote:I'm having trouble with downloading both versions of the template to check for you, please be patient I will get back with solution soon!


Hi Don,

Friendly bump to get this topic back in the queue.

Any progress toward an answer regarding how to not display the mainmenu on certain pages, i.e., landing pages?

Thanks,
railer
User avatar
Gold Boarder

GK User
Wed Feb 22, 2012 2:27 pm
Hi Railer,

I'm sorry for this delay. Here is my solution (can be applied for both Joomla 1.5 and 2.5):

Open file: \templates\gk_appsite\layouts\default.php

Find this code to remove:
Code: Select all
   <?php $this->loadBlock('nav'); ?>
User avatar
Platinum Boarder

GK User
Wed Feb 22, 2012 3:11 pm
Hi Don,

Thanks for your solution. It looks like that would remove the menu from all pages, no? I just want to remove it from specific content article ID pages, i.e., from landing page articles (which, btw, don't have a menu item link to them.)

Is there some kind of an If/then statement you could create to only take out the nav menu of pages showing certain content ID numbers in an array?

Does that make sense?

Thanks,
azurelink
User avatar
Gold Boarder

GK User
Wed Feb 22, 2012 3:18 pm
Hi,

So, in such cases we can just use css as well. What you need to do is to create a menu item for your page which you don't want to show menu there. In the setting page of that menu item, add a suffix class for it, let's say "myclass", then add this code to CSS Override option of template setting:
Code: Select all
.myclass > #gkMainNav{
display: none;
}
User avatar
Platinum Boarder

GK User
Wed Feb 22, 2012 3:31 pm
Hi Don,

I would rather not have to go through the step of having to make menu items for these landing pages.

Isn't there some other way that I can just add the article IDs to a single php array whenever I make a new landing page?

I'm going to have many landing pages for each salesperson and each advertising campaign so that we can track their effectiveness. Having to make menu items for each one will double the work.

Please let me know if that is possible to do with some kind of an array?

Btw, in AppSite, the mainmenu module is unpublished, anyway. So I don't think the CSS solution would work.

Thank you,
azurelink
User avatar
Gold Boarder

GK User
Wed Feb 22, 2012 4:44 pm
Don,

If I added the following code in the /templates/gk_appsite/layouts/default.php file in place of the <?php $this->loadBlock)'nav"); ?> line, would it work? Please revise as needed:

Code: Select all
<?php
$lpagearr = array("108", "109", "111", "118", "119", "120", "121", "122");
$article->id;

if (in_array($article->id, $lpagearr, TRUE)){
   
}
else {
  $this->loadBlock('nav');
}
?>


Thanks,
azurelink
User avatar
Gold Boarder

GK User
Wed Feb 22, 2012 5:07 pm
The code below did not do anything, as is.
User avatar
Gold Boarder

GK User
Wed Feb 22, 2012 9:27 pm
Looks like the following code does work. I put in the article IDs for each of my landing pages in the $lpagearr array. As mentioned below, it replaces the code near line 104 in /templates/gk_appsite/layouts/default.php: <?php $this->loadBlock('nav"); ?>

Maybe someone else can comment on if the code needs to be cleaned up. I tested it in Firefox and Chrome. Seems to work, but I'm not really a coder.

Please advise. Help is welcomed...

Thanks,
azurelink

Code: Select all
<?php
$lpagearr = array("108", "109", "111", "118", "119", "120", "121", "122");
$articleId = JRequest::getInt('id');
if (in_array($articleId, $lpagearr, TRUE)){
   
}
else {
  $this->loadBlock('nav');
}
?>
User avatar
Gold Boarder

GK User
Thu Feb 23, 2012 10:26 am
The code can be shortened like this:
Code: Select all
<?php
$lpagearr = array("108", "109", "111", "118", "119", "120", "121", "122");
$articleId = JRequest::getInt('id');
if (!in_array($articleId, $lpagearr, TRUE)){
   $this->loadBlock('nav');
}
?>
User avatar
Platinum Boarder

GK User
Thu Feb 23, 2012 1:34 pm
Excellent! Thanks Don.
I note the addition of the exclamation point before the !in_array function. I was wondering what to do with the empty curly brackets. LoL!
Each time I make a new landing page, I can add its article ID number to the array and then the nav block won't display on that page.

Thank you,
Azurelink
User avatar
Gold Boarder

GK User
Thu Feb 23, 2012 6:58 pm
No problem at all, you are most welcome here man, just feel free to let me know if you need any other helps.

Cheers,
User avatar
Platinum Boarder


cron