-
AuthorPosts
-
kansen Friend
kansen
- Join date:
- September 2008
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 8
- Thanked:
- 12 times in 1 posts
September 18, 2010 at 8:41 pm #154434hello
now in my frontpage and blog view pages my articles are listed like
but i need to set some banners or images each 2 or 3 items on the list like this
how can i manage the arry of articles listed?
any clue?thanks
-
Saguaros Moderator
Saguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
September 20, 2010 at 5:04 am #356026now, you open the file: templatesTEMPLATE NAMEhtmlcom_contentfrontpagedefault.php and find the following code:
[PHP]
echo $this->loadTemplate(‘item’); ?>
</div><?php endfor; ?>
[/PHP]replace:
[PHP]
echo $this->loadTemplate(‘item’); ?>
</div><?php echo $i;?><div class=”test”><jdoc:include type=”modules” style=”raw” name=”banner-<?php echo $i;?>” /></div>
<?php endfor; ?>
[/PHP]When done, each article has a new position:
for example: article 1: it’s banner-0 position, now, you put your module on therekansen Friendkansen
- Join date:
- September 2008
- Posts:
- 86
- Downloads:
- 0
- Uploads:
- 25
- Thanks:
- 8
- Thanked:
- 12 times in 1 posts
September 22, 2010 at 1:27 am #356302hello, thanks for reply
i got your point of view, i copied the code as you said in default.php,
<div class="article_row<?php echo $this->escape($this->params->get('pageclass_sfx')); ?> cols<?php echo $colcount; ?> clearfix">
<?php for ($z = 0; $z < $colcount && $ii < $introcount && $i < $this->total; $z++, $i++, $ii++) : ?>
<div class="article_column column<?php echo $z + 1; ?>" >
<?php $this->item =& $this->getItem($i, $this->params);
echo $this->loadTemplate('item'); ?></div>
<?php echo $i;?><div class="test"><jdoc:include type="modules" style="raw" name="banner-<?php echo $i;?>" /></div>
<?php endfor; ?>
</div>
it works in someway, it show the $i values from the for
8949
it show the module name too in the web code
8948
i set the position of a test module with a picture in admin and save
8947
but it doesnt show anything on frontpage or web code
what could be missing?
cheers
- billyk Friend
billyk
- Join date:
- January 2006
- Posts:
- 172
- Downloads:
- 0
- Uploads:
- 6
- Thanks:
- 28
- Thanked:
- 17 times in 1 posts
February 19, 2011 at 6:35 pm #377486did you ever get this figured out? all i see are numbers now
<em>@kansen 194997 wrote:</em><blockquote>hello, thanks for reply
i got your point of view, i copied the code as you said in default.php,
<div class="article_row<?php echo $this->escape($this->params->get('pageclass_sfx')); ?> cols<?php echo $colcount; ?> clearfix">
<?php for ($z = 0; $z < $colcount && $ii < $introcount && $i < $this->total; $z++, $i++, $ii++) : ?>
<div class="article_column column<?php echo $z + 1; ?>" >
<?php $this->item =& $this->getItem($i, $this->params);
echo $this->loadTemplate('item'); ?></div>
<?php echo $i;?><div class="test"><jdoc:include type="modules" style="raw" name="banner-<?php echo $i;?>" /></div>
<?php endfor; ?>
</div>
it works in someway, it show the $i values from the for
8949
it show the module name too in the web code
8948
i set the position of a test module with a picture in admin and save
8947
but it doesnt show anything on frontpage or web code
what could be missing?
cheers</blockquote>
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
February 21, 2011 at 7:15 am #377675You open : templatesTEMPLATE NAMEhtmlcom_contentfrontpagedefault.php and find:
[PHP]defined(‘_JEXEC’) or die(‘Restricted access’);[/PHP]
replace by:
[PHP]
defined(‘_JEXEC’) or die(‘Restricted access’);
function loadModulesByPosition( $position=” ){
$modules = JModuleHelper::getModules( $position );
if( $modules ) {
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer(‘module’);
$output=”;
foreach( $modules as $module ){
$output .= ‘<div class=”lof-module”>’.$renderer->render( $module, array(‘style’ => ‘raw’) ).'</div>’;
}
return $output;
}
return ;
}[/PHP]
and then find:
[PHP]
echo $this->loadTemplate(‘item’); ?>
[/PHP]Replace with :
[PHP]
echo $this->loadTemplate(‘item’); ?>
<?php echo loadModulesByPosition( ‘banner-‘.$i ); ?>
[/PHP]1 user says Thank You to Saguaros for this useful post
June 2, 2011 at 7:33 pm #394371<em>@tienhc 222795 wrote:</em><blockquote>You open : templatesTEMPLATE NAMEhtmlcom_contentfrontpagedefault.php and find:
[PHP]defined(‘_JEXEC’) or die(‘Restricted access’);[/PHP]
replace by:
[PHP]
defined(‘_JEXEC’) or die(‘Restricted access’);
function loadModulesByPosition( $position=” ){
$modules = JModuleHelper::getModules( $position );
if( $modules ) {
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer(‘module’);
$output=”;
foreach( $modules as $module ){
$output .= ‘<div class=”lof-module”>’.$renderer->render( $module, array(‘style’ => ‘raw’) ).'</div>’;
}
return $output;
}
return ;
}[/PHP]
and then find:
[PHP]
echo $this->loadTemplate(‘item’); ?>
[/PHP]Replace with :
[PHP]
echo $this->loadTemplate(‘item’); ?>
<?php echo loadModulesByPosition( ‘banner-‘.$i ); ?>
[/PHP]</blockquote>
tried and i get this error “Parse error: syntax error, unexpected T_VARIABLE” maybe from typos on the code?any help fixing the code would be greatly appreciated.
June 27, 2011 at 12:31 am #398514i think i got it working but only for intro articles, how can we use this for articles on colums?
chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
June 27, 2011 at 4:28 am #398549Hi pablofw
You add this code
<?php echo loadModulesByPosition( 'banner-'.$y ); ?>
after
<div class="items-row cols-<?php echo $colcount; ?> row-<?php echo $y ?> clearfix">
<?php for ($z = 0; $z < $colcount && $ii < $introcount && $i < $this->total; $z++, $i++, $ii++) : ?>
<div class="item column<?php echo $z; ?>" >
<?php $this->item =& $this->getItem($i, $this->params);
echo $this->loadTemplate('item'); ?>
</div>
<?php endfor; ?>
</div>
1 user says Thank You to chavan for this useful post
July 22, 2011 at 9:53 pm #402593thanks for the reply dohq
my default.php is different from the one you posted, could you please show me how to put your code here? i’m desperate!
// init vars
$count = min($this->params->get('num_intro_articles', 4), ($this->total - $i));
$rows = ceil($count / $this->params->get('num_columns', 2));
$columns = array();// create intro columns
for ($j = 0; $j < $count; $j++, $i++) {if ($this->params->get('multi_column_order', 1) == 0) {
// order down
$column = intval($j / $rows);
} else {
// order across
$column = $j % $this->params->get('num_columns', 2);
}if (!isset($columns[$column])) {
$columns[$column] = '';
}$this->item =& $this->getItem($i, $this->params);
$columns[$column] .= $this->loadTemplate('item');
}// render intro columns
$count = count($columns);
if ($count) {
if ($count != 1) {
echo '<div class="teaserarticles multicolumns">';
} else {
echo '<div class="teaserarticles">';
}
for ($j = 0; $j < $count; $j++) {
$firstlast = "";
if ($count != 1) {
if ($j == 0) $firstlast = "first";
if ($j == $count - 1) $firstlast = "last";
}
echo '<div class="'.$firstlast.' float-left width'.intval(100 / $count).'">'.$columns[$j].'</div>';
}
echo '</div>';
}
}
?>chavan Friendchavan
- Join date:
- October 2014
- Posts:
- 4612
- Downloads:
- 0
- Uploads:
- 110
- Thanked:
- 1440 times in 1290 posts
July 23, 2011 at 1:47 am #402602Hi pablofw
You should try paste in end of this block code
for ($j = 0; $j < $count; $j++, $i++) {if ($this->params->get('multi_column_order', 1) == 0) {
// order down
$column = intval($j / $rows);
} else {
// order across
$column = $j % $this->params->get('num_columns', 2);
}if (!isset($columns[$column])) {
$columns[$column] = '';
}$this->item =& $this->getItem($i, $this->params);
$columns[$column] .= $this->loadTemplate('item');
}
or
$count = count($columns);
if ($count) {
if ($count != 1) {
echo '<div class="teaserarticles multicolumns">';
} else {
echo '<div class="teaserarticles">';
}
for ($j = 0; $j < $count; $j++) {
$firstlast = "";
if ($count != 1) {
if ($j == 0) $firstlast = "first";
if ($j == $count - 1) $firstlast = "last";
}
echo '<div class="'.$firstlast.' float-left width'.intval(100 / $count).'">'.$columns[$j].'</div>';
}
echo '</div>';
}AuthorPostsViewing 11 posts - 1 through 11 (of 11 total)This topic contains 11 replies, has 5 voices, and was last updated by pablofw 13 years, 4 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Jump to forum
how to embed pictures or banners between frontpage articles? (blog view)
Viewing 11 posts - 1 through 11 (of 11 total)