Hi GreyHead
The Itemid remains elusive despite all our efforts🙄
I have tried a number of options based on the URI documentation, but no success. I must be missing something in the process - after all I am following the derivative method of learning (first derive what does not work and then hope to get lucky)
Here is the code I have been using:
The WHERE SQL:
<?php
if ( !$mainframe->isSite() ) { return; }
$uri =& JFactory::getURI();
$menu_itemid = $uri->get('Itemid');
$category_id = "";
$sCategory_name = "";
if ( $menu_itemid ) {
$db =& JFactory::getDBO();
$query = "
SELECT `fki_k2_cat_ID`
FROM `#__k2_cat_cc_menu`
WHERE `fki_menu_ID` = ".$db->quote($menu_itemid)." ;
";
$db->setQuery($query);
$category_id = $db->loadResult();
$query = "
SELECT `name`
FROM `#__k2_categories`
WHERE `id` = ".$db->quote($category_id)." ;
";
$db->setQuery($query);
$sCategory_name = $db->loadResult();
}
echo "WHERE fki_category_ID = "$category_id;
?>
The HEADER Section:
<style type="text/css">
div.data_grid_head {
height:16px;
width:609px;
font-size:11px;
font-weight:700;
background:#fffbfb;
border-top:1px solid #ea8484;
border-bottom:1px solid #ea8484;
border-left:1px solid #ea8484;
margin-top:15px;}
div.data_grid_row {
height:16px;
width:609px;
font-weight:400;
border-left:1px solid #ea8484;
border-bottom:1px solid #FFE6E6;}
div.data_grid_element {
height:16px;
font-size:11px;
color:#800000;
float:left;
border-right:1px solid #ea8484;
padding: 0 3px 0 3px;}
div.data_grid_foot {
float:left;
height:16px;
text-align:center;
border-top:1px solid #ea8484;
border-bottom:1px solid #ea8484;
border-left:1px solid #ea8484;
background:#fffbfb;
margin-bottom:15px;}
a:link {
font-size:11px;
font-weight:700 !important;}
a:visited {
font-weight:700 !important;}
div.limit {margin:5px 0;}
div.counter {margin:5px 0;}
a.pagenav {margin:5px 0;}
</style>
<div class="componentheading">Category: <?php echo $sCategory_name; ?></div>
<?php
$uri =& JFactory::getURI();
$item_id = $uri->get('Itemid');
echo'<br /><div><strong>$uri:</strong> '.print_r($uri, true).'</div><br />';
echo'<div><strong>$item_id:</strong? '.print_r($item_id, true).'</div><br />';
echo'<div><strong>$category_id:</strong? '.print_r($category_id, true).'</div>';
?>
<div class="data_grid_head">
<div class="data_grid_element" style="width:260px">Organization</div>
<div class="data_grid_element" style="width:140px">Category</div>
<div class="data_grid_element" style="width:120px">City</div>
<div class="data_grid_element" style="width:61px">Telephone</div>
</div>
The BODY Section:
<div class="data_grid_row">
<div class="data_grid_element" style="width:260px;font-weight:700;"><a href="index.php?option=com_k2&view=item&id={fki_item_ID}:{sItem_title}&Itemid={menu_itemid}">{sItem_title}</a></div>
<div class="data_grid_element" style="width:140px">{sCategory_name}</div>
<div class="data_grid_element" style="width:120px">{sCity}</div>
<div class="data_grid_element" style="width:61px">{sTelephone}</div>
</div>
The FOOTER Section:
<div class="data_grid_foot">
<div class="data_grid_element" style="width:602px; background:#fffbfb">-- End of results --</div>
</div>
<br />
<div class="data_grid_foot" style="height:65px">
<div class="data_grid_element" style="width:602px;height:65px;background:#fffbfb">{pagination}</div>
</div>
I can post a screen grab to show the results as soon as I can work out how to include an image.
Here is the Text that is rendered before the list:
$uri: JURI Object ( [_uri] =>
http://localhost/islagosb1a/index.php?option=com_chronoconnectivity&Itemid=82 [_scheme] => http [_host] => localhost [_port] => [_user] => [_pass] => [_path] => /islagosb1a/index.php [_query] => option=com_chronoconnectivity&Itemid=82 [_fragment] => [_vars] => Array ( [option] => com_chronoconnectivity [Itemid] => 82 ) [_errors] => Array ( ) )
$item_id:
$category_id: