Posted on: 01/13/06 11:24am
By: Anonymous (thoma)
Hi,
I created a static page wich does what I want with the below PHP. (Thanks Marc)
Only problem is I want it on the right hand column not in the center. I'm assumng this requites creation of a block by putting the below script into custom lib.php. Tried it but couldn't get it to work any help would be appreciated.
$numStories = 10;
$result = DB_query("Select sid, title,unix_timestamp(date) AS day FROM {$_TABLES['stories']} WHERE (date
$nrows = DB_numRows($result);
for ($i = 1; $i
$A = DB_fetchArray($result);
$retval .= date("M d",$A['day']) . ' --
' . stripslashes($A['title']) . '';
}
return $retval;
Static page for left hand column
Posted on: 01/13/06 12:56pm
By: jmucchiello
Should be doable as a PHP block. Did you name the function correctly for use as a PHP block?
Static page for left hand column
Posted on: 01/13/06 08:53pm
By: Anonymous (thoma)
I used this-
function phpblock_stories()
{
$numStories = 10;
$result = DB_query("Select sid, title,unix_timestamp(date) AS day FROM {$_TABLES['stories']} WHERE (date
$nrows = DB_numRows($result);
for ($i = 1; $i
$A = DB_fetchArray($result);
$retval .= date("M d",$A['day']) . ' -- <a href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid'] . '">' . stripslashes($A['title']) . '</a><BR>';
}
return $retval;
}
Static page for left hand column
Posted on: 01/14/06 03:39am
By: Dirk
Part of your code was eaten by our HTML filter. Use the forum's CODE button next time. And it would help if you could be
more specific[*1] when describing your problem ...
Looks like you're missing a
global $_TABLES;
statement at least.
bye, Dirk
Static page for left hand column
Posted on: 01/16/06 01:57pm
By: Anonymous (thoma)
Thanks Dirk,
Do you know if I have to add more than $_TABLES ?
How do I would I know what to add?
Mike
Static page for left hand column
Posted on: 01/16/06 02:18pm
By: Dirk
If you can't get it to work, post your code again (using the CODE button this time) so someone can have a look.
bye, Dirk
Static page for left hand column
Posted on: 01/16/06 03:01pm
By: Anonymous (thoma)
ERROR
Matching CODE tag missing. Unable to format message.
Static page for left hand column
Posted on: 01/16/06 03:08pm
By: Anonymous (thoma)
I'm taking the code from the older stories thread:
http://www.geeklog.net/comment.php?mode=display&format=threaded&order=ASC&pid=12286
I will still try to put the code in the next message.
Static page for left hand column
Posted on: 01/16/06 03:09pm
By: Anonymous (thoma)
$numStories = 10;
$result = DB_query("Select sid, title,unix_timestamp(date) AS day FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0) ORDER BY date DESC LIMIT $numStories");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
$retval .= date("M d",$A['day']) . ' -- <a href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid'] . '">' . stripslashes($A['title']) . '</a><BR>';
}
return $retval;
Static page for left hand column
Posted on: 01/16/06 03:14pm
By: Anonymous (thoma)
I would like to know if I need to add more than:
function phpblock_stories()
{
global $_TABLES;
to the above script I posted in the last email.
Static page for left hand column
Posted on: 01/16/06 03:26pm
By: Dirk
global $_CONF, $_TABLES;
from what I can see. Did you try it?
bye, Dirk
Static page for left hand column
Posted on: 01/16/06 04:34pm
By: Anonymous (thoma)
yeah it works thanks very much.