Originally posted by Zest
View Post
Announcement
Collapse
No announcement yet.
List from just one section level...
Collapse
X
-
<actinic:variable name="SectionName" /> is the Section Name of the current section so it would change as you move through the levels of the navigation. the code given earlier already gets the Section Text which is the database field that holds the section name, so all you have to do is modify the code in GetLevel1Section() to return both the ID and the name and then split the returned code into two variables that you can use instead of just one. You can return the two items in the resultage string by separating them with "|", take a look in Gabes code to see how he was doing it and then splitting out the items.
-
Try thisOriginally posted by Zest View PostBrill, this work great! Just typed in wrong. Just one last thing to finish this off?
How can I now add a menu header e.g.
<h2><actinic:variable name="SectionName" /></h2>
But this stay static for the level 1 header? It would also be good to identify this so you have some code that could also fetch the brand logo?
Hope you can help
Now when you call GetLevel1SectionWrapper pass it a value (0 or 1) to select the return value of SectionID or SectionName.Code:if (!function_exists('GetLevel1Section')) { function GetLevel1Section($connect,$sectref) { $query = "SELECT [Section Text], [nParentSectionID], [nSectionID] FROM [Catalog Section] WHERE [nSectionID] LIKE '".$sectref."'"; $result = odbc_exec($connect, $query); $returnstring=""; while(odbc_fetch_row($result)){ $SectionText = odbc_result($result, 1); $nParentSectionID = odbc_result($result, 2); $nSectionID = odbc_result($result, 3); if ($nParentSectionID!=0) { $returnstring=GetLevel1Section($connect,$nParentSectionID); } else { $returnstring=$nSectionID."|".$SectionText; } } odbc_free_result($result); //odbc_close($connect); return $returnstring; } } if (!function_exists('GetLevel1SectionWrapper')) { function GetLevel1SectionWrapper($sectid,myresult) { $connect = odbc_pconnect("ActinicCatalog9","","", SQL_CUR_USE_ODBC); $resultage = GetLevel1Section($connect,$sectid); $resultarray = explode("|", $resultage); odbc_close_all(); return $resultarray[myresult]; } }
To get top level section ID
To get top level section nameCode:<actinic:block php="true" > MakeNav(GetLevel1SectionWrapper('<actinic:variable name="SectionID" selectable="false" />',0),2,0,<actinic:variable name="SectionID" selectable="false" />); </actinic:block>
Code:<actinic:block php="true" > echo GetLevel1SectionWrapper('<actinic:variable name="SectionID" selectable="false" />',1); </actinic:block>
Comment
-
OopsOriginally posted by Zest View PostGreat, Thanks but above code returns error:
Parse error, expecting `''' or `T VARIABLE' in main on line 39
if (!function_exists('GetLevel1SectionWrapper')) {
function GetLevel1SectionWrapper($sectid,myresult) {
Mixing my programming languages the line should be
and notCode:$returnstring=$nSectionID."|".$SectionText;
I have corrected the original postCode:$returnstring=$nSectionID + "|" + $SectionText;
Comment
Comment