|
Page 3 of 4 Frontend view - jportfsimple.html.php - contains all output functions.
jportfsimple.html.php // no direct access defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); /** * Displaying all categories */ function display_categories( $option, &$rows ) { global $jpConf, $Itemid, $mosConfig_live_site; ?> <div id="jp_front"> <div id="jp_fronttitle"> <?php echo $jpConf-> title; ?> </div> <?php if ($jpConf->description) { ?> <div id="jp_frontdesc"> <?php echo $jpConf-> description; ?> </div> <?php } ?> <div id="jp_frontcategories"> <?php // if no rows then display: No categories defined ! if (! $rows) echo _COM_JP_NO_CAT; else foreach($rows as $row) { if ($row->published) { $link='<a href="'.sefRelToAbs( 'index.php?option='.$option.'&cat='.$row->id.'&Itemid='.$Itemid).'">'; echo '<div class="jp_frontcategory">'; echo '<div class="jp_frontcatname">'; echo $link. $row-> cat_name. '</a><br />'; echo '<div class="jp_frontcatimage">'; if ($row->cat_image) echo $link. '<img src="'. $mosConfig_live_site. '/'. $jpConf-> base_path. $row-> cat_image. '" border="0" alt="" /></a>'; echo '<div class="jp_frontcatinfo">'; } } bottom(); }
Lines 20 to 28 - shows component title and description line 33 - shows warning if there are no categories 35 to 54 - loop through categories and shows their name, description and image, if exists in line 38 function sefRelToAbs is used so links work when SEF is enabled As you can see, almost each displayed element is surrounded with <div> element, each with specific id or class. This way component display is not based on tables, but uses CSS.
jportfsimple.html.php /** * Displaying all projects in one category */ function display_one_cat( $catid, $catname, $catinfo, $catpath, &$rows, &$params, &$pageNav ) { global $jpConf, $option, $Itemid, $mosConfig_absolute_path, $mosConfig_live_site; echo '<div id="jp_front">'; echo '<div id="jp_cattitle">'._COM_JP_CAT_NAME. $catname. '</div>'; if ($catinfo) echo '<div id="jp_catinfo">'. $catinfo. '</div>'; echo '<div id="jp_onecat">'; // if no rows then display: No projects defined ! if (! $rows) echo _COM_JP_NO_PROJ; // go through all projects on given page for($i=$pageNav->limitstart; $i < ($pageNav->limitstart+$pageNav->limit) && $i < $pageNav->total; $i++) if ($rows[$i]) { $src=$jpConf->base_path.$catpath.'/'.$rows[$i]->proj_image; // if image defined exist, then show it, or show no_image.jpg if (! file_exists($mosConfig_absolute_path. '/'. $src) | is_dir($mosConfig_absolute_path. '/'. $src)) { $src=$mosConfig_live_site.'/components/com_jportfsimple/images/no_image.jpg'; } $link2=sefRelToAbs( 'index.php?option='.$option.'&cat='.$catid.'&project='.$rows[$i]->id.'&Itemid='.$Itemid); $prname=$rows[$i]->name; echo '<div class="jp_onecat_proj">'; echo '<div class="jp_onecat_img"><div class="jp_onecat_img2"><a href="'. $link2. '"><img src="'. $src. '" border="0" alt="" /></a></div></div>'; echo '<div class="jp_onecat_name"><a href="'. $link2. '">'. $prname. '</a></div>'; } // if item navigation enabled, then show page number if ( $params->get( 'item_navigation' ) && !($pageNav->limit == $pageNav->total) ) { echo '<div class="jp_pagination">'; $link='index.php?option='.$option.'&cat='.$catid.'&Itemid='.$Itemid; echo $pageNav-> writePagesLinks( $link ); } // if back button enabled, show it if ( $params->get( 'back_button' )) { echo '<div class="jp_back">'; mosHTML::BackButton ( $params ); } bottom(); }
line 76 - uses limit and limitstart (from $pageNav) to loop through all projects on given page 95 to 102 - shows page numbers, if it should
104 to 110 - shows back button, if enabled
jportfsimple.html.php /** * Displaying one project */ function display_project( $catid, $catname, $catpath, &$proj, &$params ) { global $database, $option, $Itemid, $jpConf, $mosConfig_absolute_path, $mosConfig_live_site; echo '<div id="jp_front">'; echo '<div id="jp_cattitle">'._COM_JP_CAT_NAME. $catname. '</div>'; echo '<div id="jp_projtop" >'._COM_JP_PROJ_NAME. $proj[0]-> name. '</div>'; echo '<div id="jp_projcont" >'; echo '<div id="jp_projimage" >'; $src=$jpConf->base_path.$catpath.'/'.$proj[0]->proj_image; // if image defined exist, then show it, or show no_image.jpg if (! file_exists($mosConfig_absolute_path. '/'. $src) | is_dir($mosConfig_absolute_path. '/'. $src)) { $src=$mosConfig_live_site.'/components/com_jportfsimple/images/no_image.jpg'; } echo '<img src="'. $src. '" border="0" alt="" />'; echo '<div id="jp_projdesc" >'; echo $proj[0]-> description. '<br />'; // if back button enabled, show it if ( $params->get( 'back_button' )) { echo '<div class="jp_back">'; mosHTML::BackButton ( $params ); } bottom(); } /** * Displaying component footer */ function bottom() { ?> <div align="right" style="float:right; width:60%; line-height:6px; padding:3px;"> <span class="small"> <br /><br /><br /> <a href="http://www.anetus.com/_r/jportfolio-component-for-joomla-cms" target="_blank" title="JPortfolio - component for Joomla! CMS">jp</a> </span> </div> <?php } ?>
Function display_project does exactly what the name suggests - it displays one project. Last one: bottom() - this is the function showing component footer, something like link to component web page and/or copyright information. It is not necessary to have, of course ;)
|