Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 24, 2012, 06:51:01 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
155465
Posts in
21707
Topics by
7732
Members
Latest Member:
DarrellDD
WebsiteBaker Community Forum
English
Help & Support
(Moderators:
Argos
,
badknight
)
show a news category's entries in page
Pages: [
1
]
Go Down
Author
Topic: show a news category's entries in page (Read 904 times)
spida
Offline
Posts: 203
show a news category's entries in page
«
on:
November 18, 2008, 04:41:56 PM »
Hello!
I want to include a news category's entries in a page. I thought this might be accomplished with a code page.
I do use a code page on the site in order to display a certain page. The code I use is this one:
Code:
$pid = 2;
$gc = $database->query("SELECT content_long FROM ".TABLE_PREFIX."mod_news_posts WHERE post_id = ' ".$pid." ' ");
$rc = $gc->fetchRow();
echo $rc['content_long'];
I thought this could be a starting point and tried to use the group_id instead of the post_id:
Code:
$gid = 9;
$gc = $database->query("SELECT content_long FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id = ' ".$gid." ' ");
$rc = $gc->fetchRow();
echo $rc['content_long'];
It doesn't work though, instead the first (the oldest) post of the category is displayed.
Does anyone have an idea on how to do this?
Cheers,
spida
Logged
vyni
Offline
Posts: 566
Re: show a news category's entries in page
«
Reply #1 on:
November 18, 2008, 07:29:48 PM »
I don´t know - but try
the snippet anynews with group defined instead.
get and install anynews, than call it like this
display_news_items(9);
regards from Himberg, next to Vienna
«
Last Edit: November 18, 2008, 07:55:12 PM by vyni
»
Logged
PS: Falls jemand eine Idee hat was zu tun ist und mir das erklären könnt - geh bitte davon aus dass ich ahnungslos bin, was php und so betrifft. Ich kann grad was lesen, kopieren und einfügen, ungefähr verfolgen und glauben.
Ruud
WebsiteBaker Org e.V.
Offline
Posts: 2295
Re: show a news category's entries in page
«
Reply #2 on:
November 18, 2008, 11:16:01 PM »
Looking at your code you want to display one post.
Have you looked at
this module
?
Ruud
Logged
Professional WebsiteBaker Solutions
spida
Offline
Posts: 203
Re: show a news category's entries in page
«
Reply #3 on:
November 20, 2008, 09:29:06 PM »
@ruud: thank you. But I only display just one news on the startpage. Nevertheless your module will be helpful on this page
@vyni: thank you for the hint. I am using the snippet but experiencing extreme problems with it. See
http://www.websitebaker2.org/forum/index.php/topic,409.msg71605.html#msg71605
cheers,
spida
Logged
thorn
Offline
Posts: 980
Re: show a news category's entries in page
«
Reply #4 on:
November 20, 2008, 10:14:06 PM »
Hello,
Quote from: spida on November 18, 2008, 04:41:56 PM
Code:
$gid = 9;
$gc = $database->query("SELECT content_long FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id = ' ".$gid." ' ");
$rc = $gc->fetchRow();
echo $rc['content_long'];
Code:
$gc = $database->query("SELECT content_long FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id = '$gid' ORDER BY position DESC LIMIT 1");
will do the trick.
thorn.
Logged
Projekte
spida
Offline
Posts: 203
Re: show a news category's entries in page
«
Reply #5 on:
November 24, 2008, 12:59:20 PM »
Hi Thorn,
looking at your code I also thought it should work, but it doesn't. This is the complete code including your part:
Code:
$gid = 9;
$gc = $database->query("SELECT content_long FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id = '$gid' ORDER BY position DESC LIMIT 1");
$rc = $gc->fetchRow();
echo $rc['content_long'];
I can't see what the problem might be...
Cheers,
spida
Logged
Ruud
WebsiteBaker Org e.V.
Offline
Posts: 2295
Re: show a news category's entries in page
«
Reply #6 on:
November 24, 2008, 01:35:13 PM »
Just tried this code in a codepage and it works fine.
The only reason I can think of is that you are not using the correct $gid.
So what exactly doesn't work for you?
Ruud
Logged
Professional WebsiteBaker Solutions
spida
Offline
Posts: 203
Re: show a news category's entries in page
«
Reply #7 on:
November 24, 2008, 03:07:42 PM »
Hi,
I checked the group id, it's correct (still number 9). There's just nothing displayed. I thought it might be a conflict with the anynews module and uninstalled it, but this didn't help either.
Do you have any further suggestions?
Cheers,
spida
Logged
Ruud
WebsiteBaker Org e.V.
Offline
Posts: 2295
Re: show a news category's entries in page
«
Reply #8 on:
November 24, 2008, 03:23:14 PM »
Hmm..
Why don't you use the module I mentioned earlier.
http://www.websitebaker2.org/forum/index.php/topic,11523.0.html
It does exactly what you are trying to do here, only it will respect the other news flags (publish dates.. active/inactive flag).
Plus.. you can select the group from a pull down list.
Instead of your code section use a "Latest News" section.
For the rest..
I can imagine CSS problems (just like in your post about the anynews snippet i would suspect a <pre> tag).
Can we heave a look at your page? (is it remotely accessible?)
Ruud
Logged
Professional WebsiteBaker Solutions
spida
Offline
Posts: 203
Re: show a news category's entries in page
«
Reply #9 on:
November 24, 2008, 03:40:01 PM »
Hi Ruud,
problem is, that your module only shows one news (i.e. the latest news of either a specific category/group or the latest news of all news).
What I need is a page that displays all the news of a specific group.
Thus I still think the code page should do, but it just doesn't bring up a result. There is no reason to suspect the CSS, since conflicts with it wouldn't result in no data display, rather in wrong data display.
(Nevertheless, I like your module for my first page. Since I have a question about it, please see
http://www.websitebaker2.org/forum/index.php/topic,11523.0.html
)
Any further help with the code is very welcome. The page in question is not publicly accessable, alas.
Cheers,
spida
Logged
Ruud
WebsiteBaker Org e.V.
Offline
Posts: 2295
Re: show a news category's entries in page
«
Reply #10 on:
November 24, 2008, 03:50:11 PM »
The code examples in this thread will show only one post.
You would need some extra coding to show all posts. Also you would probably want to see the title of the post too..
Since nothing is shown at all, you might want to go back to step one:
try in your code section something simple like
Code:
echo "Hello world";
and see if that displays.
Ruud
Logged
Professional WebsiteBaker Solutions
spida
Offline
Posts: 203
Re: show a news category's entries in page
«
Reply #11 on:
November 24, 2008, 04:09:10 PM »
Hi Ruud,
looks like we're the only ones in these two topics
Hello world is perfectly shown.
best,
spida
Logged
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...