Customizing the component and module

CSS

the file .../components/com_datafeeds/assets/datafeeds.css contain the cs used for the component and the module. Changing this file is not recommended the file is overwritten during every upgrade. Add any changes to your templates css.

Changing the layout's

template specific

Joomla provides a mechanism to change the layout for every component and module for a specific template. Simply copy

.../components/com_datafeeds/views/items/tmpl/default_.php

to

.../templates/YOUR TEMPLATE/html/com_datafeeds/items/

or

.../modules/mod_datamenu/tmpl/.php

to

.../templates/YOUR TEMPLATE/html/mod_datamenu/

and modify the copies file.

adding a custom module layout

In modules/mod_datamenu/tmpl copy a layout you want to modify; for example top5table_list.php to top5div_list.php. In the file change the name of the function to match the new file name, in this case Datatop5div_listMenu.

There are three flavours of module layout, based on the file name the dataitems array has different content:

  • for files ending with _list.php the dataitems is a  list of items based on the settings.
  • for files ending with _custom.php dataitems is empty
  • for all other files dataitems is a menu tree

Example

displays items almost like the component does

<?
#
# Copyright brambring.nl
# http://www.affiliatefeeds.nl
defined'_JEXEC' ) or die( 'Restricted access' );
function 
Datamodascom_listMenu(&$dataitems,&$params) {
?> '<div id="com_datafeeds">';
 <div class="datafeeds_clear datafeeds_fix">&​nbsp;</div>
<?php
 JHTML
::_('stylesheet''datafeed.css',
        
'components/com_datafeeds/assets/');
 
$moduleclass_sfx=$params->get('moduleclass_sfx');
 
$layout_sfx=$params->get('layout');
 
$baselink=$params->get('baselink');
 if (
is_array($dataitems) ) {
   
$more=JRoute::_($baselink);
   
$more_text=$params->get('page_title');
   foreach ( 
$dataitems as $item )  {
?>
<div class="datafeeds">
<h2>
<a target="_blank" class="dflink"
  href="/<?php echo $item['count_url'];?>"
  rel="nofollow"><?php echo $item['title'];?></a>
</h2>
<div class='datafeeds_description'>
<?php
     
echo $item['description'];
     
$s1=$item[$params->get('field1')];
     
$s2=$item[$params->get('field2')];
     
$link=JRoute::_("$baselink&" make_urlencoded(array("q1"=>$s1,
            
"q2"=>$s2)));
     print 
' <span class="top5_2"><a href="'.$link.'">'.$s2.'</a>
            </span>'
;
     if ( 
$item['Prijs'] > ) {
       
printf ('<p class="prijs"><span>&​euro; %2.2f</span></p>',
                
$item['Prijs']); }
?>
<p class="datafeeds_more">
<a  class="dflink"
   href="/<?php echo $item['count_url'];?>"
   target="_blank" rel="nofollow"
   title="<?php echo $item['title'];?>">Naar de shop</a>
</p></div>
<a class="dflink" href="/<?php echo $item['count_url'];?>"
  rel="nofollow" target="_blank">
  <img class="datafeeds_img"
       src="/<?php echo $item['image']; ?>"
       alt="<?php echo $item['title'];?>"/></a>
       <div class="datafeeds_clear datafeeds_fix">&​nbsp;</div>
</div>
<?
     
}
   }
 echo 
'</div>';
 }
?>

adding a custom sub component layout

(svn 788)

simply copy an existing default_*.php file in .../components/com_datafeeds/views/items/tmpl/ ; for example to default_better.php, the new layout should appear in the drop downbox in the menu configuration.

 

adding a compleet component layout

Copy all files

.../components/com_datafeeds/views/items/tmpl/default*.php

to

.../components/com_datafeeds/views/items/tmpl/yourname*.php

and edit the files.

This method should  work for all joomla component. There is a specific change for this component:

in the file default.xml, copied to yourname.xml you will find base='default' (twice), change this to base='yourname'

 

 

 

Plaats reactie


Beveiligingscode
Vernieuwen