Want to get description text in the link
Permalink
I want the page description below the every link of navigation
I have use the code below
and declare the variable in link as
but there is problem it brings the only current page description to all links.
can anyone help me
I have use the code below
$c = Page::getCurrentPage(); $strDesc = $c->getCollectionDescription();
and declare the variable in link as
<a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '">' . $ni->getName() . '<span>'. $strDesc .'</span></a>
but there is problem it brings the only current page description to all links.
can anyone help me
Sorry, i am new to PHP. I am not getting what is the problem.
Thanks
Thanks
The code should be like this:
$desc = $_c->getCollectionDescription(); if ($c->getCollectionID() == $_c->getCollectionID()) { echo('<li class="nav-selected nav-path-selected"><a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '">' . $ni->getName() ." <br />". $desc .'</a>'); } elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) && ($_c->getCollectionID() != HOME_CID) ) { echo('<li class="nav-path-selected"><a class="nav-path-selected" href="' . $pageLink . '" ' . $target . '>' . $ni->getName() . " <br />". $desc .'</a>'); } else { echo('<li><a href="' . $pageLink . '" ' . $target . ' >' . $ni->getName() ." <br />". $desc .'</a>'); }
Thanks a lot :)
Mark this as best answer as it will help others to find the solution.
Citytech
Citytech
Hi,
Just done something similar in my website, but it does not work at all:
http://www.concrete5.org/community/forums/customizing_c5/do-single-...
Hope you can help me.
Just done something similar in my website, but it does not work at all:
http://www.concrete5.org/community/forums/customizing_c5/do-single-...
Hope you can help me.
Which version of C5 you are using? It seems to be an earlier version as per the code.
Citytech
Citytech
I am running 5.5.2.1
Then the code should be like above, but it isn't. You can try to copy the above code & replace it with your once.
Note: Please have a backup of that view.php file first.
Citytech
Note: Please have a backup of that view.php file first.
Citytech
I modified the code to this:
but I get this error:
( ! ) Warning: in_array() expects parameter 2 to be array, null given in C:\wamp\www\ART-RENTING\c5\blocks\autonav\templates\menu_artelea.php on line 44
(All descriptions are showing except Profile's one, that is still not showing).
Thanks for your help
$desc = $_c->getCollectionDescription(); if ($c->getCollectionID() == $_c->getCollectionID()) { echo('<li class="nav-selected nav-path-selected '.$isFirstClass.'"><a class="nav-selected nav-path-selected" ' . $target . ' href="' . $pageLink . '"><span class="nnn">' . $ni->getName() . '</span><span class="desc">' . $desc . '</span></a>'); } elseif ( in_array($_c->getCollectionID(),$selectedPathCIDs) && ($_c->getCollectionID() != HOME_CID) ) { echo('<li class="nav-path-selected '.$isFirstClass.'"><a class="nav-path-selected" href="' . $pageLink . '" ' . $target . '><span class="nnn">' . $ni->getName() . '</span><span class="desc">' . $desc . '</span></a>'); } else { echo('<li class="'.$isFirstClass.'"><a href="' . $pageLink . '" ' . $target . ' ><span class="nnn">' . $ni->getName() . '</span><span class="desc">' . $desc . '</span></a>'); }
but I get this error:
( ! ) Warning: in_array() expects parameter 2 to be array, null given in C:\wamp\www\ART-RENTING\c5\blocks\autonav\templates\menu_artelea.php on line 44
(All descriptions are showing except Profile's one, that is still not showing).
Thanks for your help
give me the link of your site.
It is in localhost, but I think that the problem is with the description attribute in the profile single page, not about the code... Maybe I have to call it in other way?
Sorry Bro, I have no idea. Maybe some other member can help you.
Citytech
Citytech
No problem,
Thank you very much
Thank you very much
And call the description of that instance
I think you are intelligent enough to understand that. :)
Citytech