[MODDB] Front page news syndication

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Anti-Spam Guide
Kerotan
Registered User
Posts: 4
Joined: Thu Mar 06, 2008 2:19 am

Re: [RC1] Front page news syndication

Post by Kerotan »

Hey, I got this script working which is awsome! xP

But now ive come to editing the layout of it etc and starting to have problems.
Most of my layout is 100% fine on how I want it but I want to align the Comments to the right side of the page.

How would I do this? I tried using CSS but that just stopped the whole thing working..
Survival Bill
Registered User
Posts: 248
Joined: Tue Jun 12, 2007 3:03 am
Contact:

Re: [RC1] Front page news syndication

Post by Survival Bill »

I tried this again hopeing it would work this time but I still get this any clue as to a fix?

these are the first 3 lines

define('FORUM_ID', 17); // Forum ID to get data from
define('POST_LIMIT', 7); // How many to get
define('PHPBB_ROOT_PATH', './phpBB3/././././');


this is the error I keep getting still?

Code: Select all

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /xxx/xxx/xxxxx/xxxxxxxxx/news.php on line 2

Parse error: syntax error, unexpected T_STRING in /xxx/xxx/xxxxx/xxxxxxxxx/news.php on line 2
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: [RC1] Front page news syndication

Post by chAos »

Hey, I'm back from the dead, for a bit anyway. :P
Kerotan wrote:Hey, I got this script working which is awsome! xP

But now ive come to editing the layout of it etc and starting to have problems.
Most of my layout is 100% fine on how I want it but I want to align the Comments to the right side of the page.

How would I do this? I tried using CSS but that just stopped the whole thing working..
The way I had the CSS setup when I wrote the script is actually not the best way to do things for a number of reasons, but if you want to align the post information to the right of the post title, just add this to your CSS file.

Code: Select all

.postinfo { float: right; }
Survival Bill wrote:I tried this again hopeing it would work this time but I still get this any clue as to a fix?

these are the first 3 lines

define('FORUM_ID', 17); // Forum ID to get data from
define('POST_LIMIT', 7); // How many to get
define('PHPBB_ROOT_PATH', './phpBB3/././././');


this is the error I keep getting still?

Code: Select all

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /xxx/xxx/xxxxx/xxxxxxxxx/news.php on line 2

Parse error: syntax error, unexpected T_STRING in /xxx/xxx/xxxxx/xxxxxxxxx/news.php on line 2
It looks like you have an error on line 2 of news.php. If you copied the code exactly as the original post try removing the comments block...

Code: Select all

/******************************************************************************
* POST SYNDICATION SCRIPT by chAos
*
* A very basic script that pulls threads with the first post from the database
* and puts them into an array form so you can use them as you like.
*
* For use with phpBB3, freely distributable
*
******************************************************************************/
If you spliced it into existing code though you should check that line for a "\" character that shouldn't be there. :) Also, for your PHPBB_ROOT_PATH, those "./"'s at the end are the same as saying "current directory" so they're redundant.
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: [RC1] Front page news syndication

Post by chAos »

iamgregg wrote:I have a problem where single quotes, double quotes etc are replaced with characters like '’'.

Any idea what the problem is here?
This is likely a problem with the encoding of the page (ie. if you're using a language other than English). If that's the case, you should probably check if you have a <meta> tag in the header that's setting the encoding something different to the forum. Other than that, I'm not sure what the best way around that would be since I can't really test it myself. If you are using English though that is odd.
yungb wrote:Hey everyone. I downloaded this script and it works perfectly, except two things.

Number one, I get the "Cannot modify header information" error, only in IE. I've tried the fix posted in this thread, but it didn't seem to work.

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/session.php on line 942: Cannot modify header information - headers already sent by (output started at /.../index.php:7)
First up, that error shouldn't be dependent on what browser you're using. It crops up if there's HTML (although it's usually an accidental whitespace) inserted before the original code.
yungb wrote:My other problem is I'm kind of a noob to both PHP and PHPBB. My question is, how do I use the news array? I try but it never works, instead, it seems the array never has a value. I do have print_to_screen set to False (I also tried 0). Still nothing. When I set it to true or 1, it works. Here is what I'm doing:

Code: Select all

echo "<h2>" . $news['topic_title'] . "</h2>";
I tried having the script in a separate file, as well as inserting it in the index file. Both are no good.
You've got the right idea. Provided the previous problem is fixed, you should be able to access the data by using a foreach loop. For example:

Code: Select all

foreach($news as $post)
{
	echo "<h2>{$post['topic_title']}</h2>";
	echo "<p>{$post['post_text']}</p>";
}
plasmatic
Registered User
Posts: 14
Joined: Tue Dec 12, 2006 3:34 am

Re: [Final] Front page news syndication

Post by plasmatic »

Just what I was looking for. Thanks!
plasmatic
Registered User
Posts: 14
Joined: Tue Dec 12, 2006 3:34 am

Re: [Final] Front page news syndication

Post by plasmatic »

Quick question, I'm using this with a .html format page, how would I use the news array? Would it be a <!-- BEGIN news --> tag?
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: [Final] Front page news syndication

Post by chAos »

plasmatic wrote:Quick question, I'm using this with a .html format page, how would I use the news array? Would it be a <!-- BEGIN news --> tag?
It can only be used as PHP; there's no templating functionality for HTML.

Also please use this thread in the future since it just passed validation. :)
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 17238
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: [Final] Front page news syndication

Post by DavidIQ »

As chAos stated, this topic is no longer valid. Please use the release topic for any further support.

Locking.
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
Locked

Return to “[3.0.x] MODs in Development”