Display Pages Short Description under page link in menu categories left column

MoverRen

Avatar: MoverRen

2015-01-21 20:35

Hello,
I need some help with displaying Pages Short Description in left column menu under page link, just like it is done in Simple News plugin.
I've got answer from Boboo that it is possible, but I don't know how to do it.

Any help would be appreciated.
Thanks

PS
It would be great if anyone can post how to do it where and what to add or change, because I am not expert.

» Quick.Cart v6.x

Left menu like Simple News

boboo

Avatar: boboo

2015-01-22 07:50

Look, my friend, into /core/pages.php -> function throwMenu.
The funcition uses 3 parameters: iType, iPageCurrent, iDepthLimit:
The iType determines the menu ("1" for top menu [with basket], "2" for the horizontal menu over the content, "3" for the left menu)
The iPageCurrent gives the information which page has been chosen/is open and will be shown as selected and her subPages will be created
The iDepthLimit determines how deep the menu should be shown (child nodes)

You don't ask how will it look, you ask only how to display the shortDescription.
In the foreach loop the $aData will be filled with all data from the $aPages main array ($this->aPages).
In this $aData you will find the sShortDescription as well.
But we want to display it only in left menu (iType=3)
The content of the menu ($content) begins with setting of html elemntes (<li> with setting class and so on)
and then we get our menu item:

$content .= '">  <a href="'.$aData['sLinkName'].'">'.$aData['sName'].'</a>'.


and here is the place to put the short description.

$content .= '">  <a href="'.$aData['sLinkName'].'">'.$aData['sName'].'</a>'.$aData['sDescriptionShort'].


looks promising :-) but now the short descs are shown in all menus. we dont' want this. we want only left menu -> $iType=3

$content .= '">  <a href="'.$aData['sLinkName'].'">'.$aData['sName'].'</a>'.(($iType==3)?$aData['sDescriptionShort']:null).


but there are some pages, that don't have short desc. in this case we will get the error message:
Undefined index: sDescriptionShort
so we have to ask for existing the sShortDesc in the $aData array

$content .= '">  <a href="'.$aData['sLinkName'].'">'.$aData['sName'].'</a>'.(($iType==3&&isset($aData['sDescriptionShort']))?$aData['sDescriptionShort']:null).



that's all.

You can put the shortDesc into an element (span or what ever)

.(($iType==3&&isset($aData['sDescriptionShort']))?'<span>'.$aData['sDescriptionShort'].'</span>':null).


an format this as you want.

boboo :-)

MoverRen

Avatar: MoverRen

2015-01-22 19:42

Thank you Boboo, this is great.
It is working very well, and in the rest of menus, I'll make it work.

Back to top
about us | contact