Welcome to Geeklog, Anonymous Friday, November 08 2024 @ 09:10 pm EST
Geeklog Forums
Static page for left hand column
thoma
Anonymous
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;
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;
10
9
Quote
Status: offline
jmucchiello
Forum User
Full Member
Registered: 08/29/05
Posts: 985
Should be doable as a PHP block. Did you name the function correctly for use as a PHP block?
5
10
Quote
thoma
Anonymous
I used this-
{
$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;
}
Text Formatted Code
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;
}
10
12
Quote
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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 when describing your problem ...
Looks like you're missing a
global $_TABLES;
statement at least.
bye, Dirk
Looks like you're missing a
global $_TABLES;
statement at least.
bye, Dirk
8
10
Quote
thoma
Anonymous
Thanks Dirk,
Do you know if I have to add more than $_TABLES ?
How do I would I know what to add?
Mike
Do you know if I have to add more than $_TABLES ?
How do I would I know what to add?
Mike
7
9
Quote
thoma
Anonymous
ERRORMatching CODE tag missing. Unable to format message.
12
10
Quote
thoma
Anonymous
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.
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.
10
26
Quote
thoma
Anonymous
Text Formatted Code
$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;
8
9
Quote
thoma
Anonymous
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.
function phpblock_stories()
{
global $_TABLES;
to the above script I posted in the last email.
8
10
Quote
thoma
Anonymous
yeah it works thanks very much.
13
10
Quote
All times are EST. The time is now 09:10 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content