I am not a programmer but need to do a slight adjustment to a drupal site. Can anyone help?

The code below displays 2 "news" post items on the home page. How can I make it display 3 or 4 items?

Here is the home page link: http://www.refbc.com

Thanks for any help!

<div class="holder">
	<div class="home-left-side">
		<div class="title">news &amp; Events</div>
		<table width="100%" cellpadding="0" cellspacing="0" class="news">
		<?php 
			$index = 1;
			foreach ($last_blog_post as $post): 
				if(count($last_blog_post) == $index) $class = 'class="last"';
				else $class = '';
//print_r($post);
		?>
			  <tr <?php echo $class; ?>>
			  	<?php 
			  		$chars = 35;
			  		if(strlen($post->title) > $chars) $post->title = substr($post->title,0,$chars).'...';
			  	?>
			    <th><h3 style="width: 170px;height: 55px;"><a href="<?php echo url('node/'.$post->nid);?>"><?php echo $post->title; ?></a></h3><span><?php echo date('j F Y',$post->created); ?></span></th>
			    <?php 
			  		$chars = 350;
			  		if(strlen($post->body) > $chars) $post->body = substr($post->body,0,strpos($post->body,' ',$chars)).'...';
			  	?>
			    <td>
			    	<p><?php echo strip_tags($post->teaser,'<b><a><strong>'); ?></p>
			    	<a href="<?php echo url('node/'.$post->nid);?>" class="blink">Read more</a>
			    </td>
			  </tr>
		 <?php 
		 		$index++;
		 	endforeach; 
		 ?> 
		</table>
</div>

[Edited to add <code> and </code> tags: nevets]

Comments

rahulbile’s picture

$index = 4;
Can you tell how $last_blog_post i calculated ?

Cheers

hilarudeens’s picture

hi frnd,
Your database query limits the fetched rows upto 2 (for example: select * from db_table_name limits 0,2).

As per words of Rahul go through calculating method of $last_blog_post variable and change limits value.

rgds.,
hilarudeens

phuile’s picture

Thanks ... since this is not originally developed by me, and I am no programmer, I am just tasked to change something ...

Where is it likely that I will find the $last-Blog_post calculation? I have access to all the folders and files, just need to know where to locate this line.

Thanks for any help.

hilarudeens’s picture

hi frnds,
you are new to this and need to do change add two more events in list only means try this. If you are buddy in programing go with experts drupal's contributed module like views...

Here my suggestion to locate the initiation of $last_blog_post variable

As per my assumption the variable may be theming variable...,then...,

Search keyword throughout your project by just removing "$" symbol from $last_blog_post
You may locate theme registry
(for example
'temp_var_name'=>array('template'=>'file_name_without_extension',
'arguments'=>array('last_blog_post'...
)

Now search with keyword "temp_var_name". This keyword may called within theme() function like theme('temp_var_name',$last_blog_post_alias_name.....

Note: theme('temp_var_name',$last_blog_post_alias_name..... would be called within your menu callback

Now just prior this line theme('temp_var_name',$last_blog_post_alias_name..... last_blog_post_alias_name must be get initiated....

This may clumsy.... get help from experts...

rgds.,
hilar

nevets’s picture

Using views would avoid the need to program.