Skip to content

Simple News and events in drupal block

08/08/2011

hi,

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);">
<?php
global $base_path;
$res = db_query('SELECT title,nid FROM node WHERE type="image_gallery" ORDER BY nid  DESC LIMIT 0 , 6');
$count=0;
$img="<img src='http://cdachyd.in/new_icons_10.gif'/>";
while ($row = db_fetch_array($res)) {
$count++;
if($count>3){ $img="";}
echo "<a href='?q=node/".$row['nid']."'>".$row['title'].$img."</a>"."<br>";

}
?>
</marquee>

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,

நன்றி …

சண்முகசுந்தரம்.க

Advertisements

From → Drupal

Leave a Comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: