Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 25, 2012, 01:07:27 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Interested in joining the WebsiteBaker team?
For more Information read
here
or on our
new website
.
155504
Posts in
21710
Topics by
7736
Members
Latest Member:
deenangle
WebsiteBaker Community Forum
English
Help & Support
(Moderators:
Argos
,
badknight
)
News module help
Pages: [
1
]
Go Down
Author
Topic: News module help (Read 312 times)
andyeswecan
Offline
Posts: 6
News module help
«
on:
June 03, 2009, 03:48:17 PM »
hi...
i'm a bit of a newbie to website baker and have taken on a site built by someone else.
I have the following php in my template and basically need to amend it so that i can filter results by group_id.
**
<?php
ob_start(); // start output buffer
global $database;
$query = "SELECT post_id,title,content_short,group_id,link FROM ".TABLE_PREFIX."mod_news_posts ORDER BY position DESC LIMIT 0, 5;";
$error = mysql_error();
if (!$result = mysql_query($query)) {
print "$error";
exit;
}
while($data = mysql_fetch_object($result)){
$title = $data->title;
$id = $data->post_id;
$link = $data->link;
$short = $data->content_short;
echo '<p><a href="'.WB_URL.'/pages/'.$link.PAGE_EXTENSION.'" class="latestnews">'.$title.'</a></p><p>'.$short.'</p><hr/>';
}
$foo=ob_get_contents(); // put outputbuffer in $foo
ob_end_clean(); // clear outputbuffer
if ($foo<>"") { // some code to execute cause there is some block
echo '<h3 class="latestnewsheader">Latest News</h3>';
echo $foo;
} else { // some code for no info
}
?>
**
any help would be greatly appreciated. it's probably easy for someone with more experience
thanks
Andrew
Logged
kweitzel
Forum administrator
Offline
Posts: 6975
Re: News module help
«
Reply #1 on:
June 03, 2009, 05:57:45 PM »
replace this code with the anynews snippet (look on the add-on repository). There you have moer options and don't need to have the code in the template.
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
Pages: [
1
]
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...