Skip to content

Simple News and events in drupal block



This is the php code for create a simple news and event in page or block in drupal.

<marquee direction="up" width="20%" height="30%" onmouseover="this.setAttribute('scrollamount', 0, 0);" onmouseout="this.setAttribute('scrollamount', 6, 0);">
global $base_path;
$res = db_query('SELECT title,nid FROM node WHERE type="image_gallery" ORDER BY nid  DESC LIMIT 0 , 6');
$img="<img src=''/>";
while ($row = db_fetch_array($res)) {
if($count>3){ $img="";}
echo "<a href='?q=node/".$row['nid']."'>".$row['title'].$img."</a>"."<br>";


First create a content type name as “News”. Then create a pages in news content type. Now we want to get the news content type title (News event title) from the database,And display as block or page. Enable the “Phpfilter” module, now we can see new input format, in a page or new block past the code and choose the input format as php. Now it will show as,

நன்றி …



From → Drupal

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: