How to show name of category which came?
4 posts by 2 authors in: Forums > CMS Builder
Last Post: May 26, 2010 (RSS)
By esteban - May 24, 2010
I have list of article from menu category. I would like to show this name of category with link to this category as kind of a back button. I can't show name of category. How to do this? This is article page list: http://goo.gl/yckD and article list page http://goo.gl/Vyto
This is a category list as menu: "main_menu"
acces to article list from link in menu:
<a href="article-list.php?category_num=3"
">Category 3</a>
Below all codes.
Thanks for help.
==============================================
Article List
<?php
require_once "/home/trener_osobisty/trener_osobisty/cmsAdmin/lib/viewer_functions.php";
list($main_menuRecords, $selectedCategory) = getCategories(array(
'tableName' => 'main_menu',
));
list($artykulyRecords, $artykulyMetaData) = getRecords(array(
'tableName' => 'artykuly',
'perPage' => '6',
));
?>
----------------------------------------------
<!-- STEP2: Display Records -->
<?php foreach ($artykulyRecords as $record): ?>
<?php foreach ($record['zdjecie_glowne'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $record['_link'] ?>">
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo $record['title'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" align="left" class="foto-ramka" /></a>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
<?php echo date("d.m.Y",strtotime($record['createdDate'])); ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php echo $record['zajawka'] ?>
<br />
<?php endforeach ?>
<?php if (!$artykulyRecords): ?>
No data!<br/>
<?php endif ?>
==============================================
Article detail
<?php
require_once "/home/trener_osobisty/trener_osobisty/cmsAdmin/lib/viewer_functions.php";
list($artykulyRecords, $artykulyMetaData) = getRecords(array(
'tableName' => 'artykuly',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$artykulyRecord = @$artykulyRecords[0]; // get first record
// show error message if no matching record is found
if (!$artykulyRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
----------------------------------------------
<?php echo $artykulyRecord['title'] ?>
<?php echo $artykulyRecord['zajawka'] ?>
<?php echo $artykulyRecord['content'] ?>
<?php foreach ($artykulyRecord['galeria_zdjec'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" rel="lightbox[roadtrip]"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" border="0" class="foto-ramka" /></a>
<?php $maxCols=4; if (@++$count % $maxCols == 0): ?>
<?php endif ?>
<?php endforeach; ?>
This is a category list as menu: "main_menu"
acces to article list from link in menu:
<a href="article-list.php?category_num=3"
">Category 3</a>
Below all codes.
Thanks for help.
==============================================
Article List
<?php
require_once "/home/trener_osobisty/trener_osobisty/cmsAdmin/lib/viewer_functions.php";
list($main_menuRecords, $selectedCategory) = getCategories(array(
'tableName' => 'main_menu',
));
list($artykulyRecords, $artykulyMetaData) = getRecords(array(
'tableName' => 'artykuly',
'perPage' => '6',
));
?>
----------------------------------------------
<!-- STEP2: Display Records -->
<?php foreach ($artykulyRecords as $record): ?>
<?php foreach ($record['zdjecie_glowne'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<a href="<?php echo $record['_link'] ?>">
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="<?php echo $record['title'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" border="0" align="left" class="foto-ramka" /></a>
<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->
<?php echo date("d.m.Y",strtotime($record['createdDate'])); ?>
<a href="<?php echo $record['_link'] ?>"><?php echo $record['title'] ?></a><br/>
<?php echo $record['zajawka'] ?>
<br />
<?php endforeach ?>
<?php if (!$artykulyRecords): ?>
No data!<br/>
<?php endif ?>
==============================================
Article detail
<?php
require_once "/home/trener_osobisty/trener_osobisty/cmsAdmin/lib/viewer_functions.php";
list($artykulyRecords, $artykulyMetaData) = getRecords(array(
'tableName' => 'artykuly',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$artykulyRecord = @$artykulyRecords[0]; // get first record
// show error message if no matching record is found
if (!$artykulyRecord) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}
?>
----------------------------------------------
<?php echo $artykulyRecord['title'] ?>
<?php echo $artykulyRecord['zajawka'] ?>
<?php echo $artykulyRecord['content'] ?>
<?php foreach ($artykulyRecord['galeria_zdjec'] as $upload): ?>
<a href="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" rel="lightbox[roadtrip]"><img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" border="0" class="foto-ramka" /></a>
<?php $maxCols=4; if (@++$count % $maxCols == 0): ?>
<?php endif ?>
<?php endforeach; ?>
Re: [esteban] How to show name of category which came?
By Jason - May 25, 2010
Hi,
So for each page, you want to be able to see which category they were previously in?
You could try adding some variables to your links like this:
This way, each link will have the category name of the previous page stored in $_REQUEST['category_past']. You just need to replace *CURRENT CATEGORY NAME* with the variable that is storing the current name.
Hope this helps.
So for each page, you want to be able to see which category they were previously in?
You could try adding some variables to your links like this:
<a href="article-list.php?category_num=3&category_past=<?php echo *CURRENT CATEGORY NAME*?>"
">Category 3</a>
This way, each link will have the category name of the previous page stored in $_REQUEST['category_past']. You just need to replace *CURRENT CATEGORY NAME* with the variable that is storing the current name.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] How to show name of category which came?
By esteban - May 25, 2010
I haven't any idea what to do with this. When I put this code into menu I have error. Could you explain this in the example? Whre is a code to show category?
I need the name of the category where the article is assigned and that is linking the name of the place from which I clicked on this article. A simple mechanism to return to the place from which I came.
In other words:
When I clicked to article "Sunyday" on 5th list-page category3 I would have oportunity to back to 5th list-page category3.
I need the name of the category where the article is assigned and that is linking the name of the place from which I clicked on this article. A simple mechanism to return to the place from which I came.
In other words:
When I clicked to article "Sunyday" on 5th list-page category3 I would have oportunity to back to 5th list-page category3.
Re: [esteban] How to show name of category which came?
By Jason - May 26, 2010
Hi,
I've take another look at your code, and I can't see where you're outputting a list of categories. You have your list of categories in the variable $main_menuRecords, but I you don't seem to use them.
Could you attach the file you're working with and send me a link to your page so that I can see what's happening?
Thanks.
I've take another look at your code, and I can't see where you're outputting a list of categories. You have your list of categories in the variable $main_menuRecords, but I you don't seem to use them.
Could you attach the file you're working with and send me a link to your page so that I can see what's happening?
Thanks.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/