Author |
Message |
Palbin
Site Admin
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Tue Jan 13, 2009 5:46 pm |
|
jakec, Looks good to me |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
|
gator81
Worker
Joined: Jun 09, 2007
Posts: 172
|
Posted:
Tue Jan 13, 2009 7:31 pm |
|
Ty jakec, that did it, it is working now
I will try to see what you did beyond the original so i can understand why I was getting the 500 error.
again, ty very much for the hard work. |
|
|
|
|
gator81
|
Posted:
Tue Jan 13, 2009 8:21 pm |
|
This is working great, and if you dont mind, i would like to ask another question......
could this be used in more then just a module and or block?
Now I am not wanting to push my luck but if I dont ask then I dont know. But could the quotes be added to like a content post? or placed in the header or like the bar you see at the header, like where you have "home,downloads,forums".
This is not a have to thing, but a question to see if it could be done without alot of problems.
thanks for the input |
|
|
|
|
jakec
Site Admin
Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Wed Jan 14, 2009 1:35 am |
|
I've just changed the SQL queries to suit the new layer, so these should not have been causing an error 500.
There is no reason why these couldn't be added to the header, but it would require a hack of the theme. |
|
|
|
|
gator81
|
Posted:
Wed Jan 14, 2009 2:10 am |
|
jakec, you have been a great help, and If i am being to much of a pest please let me know...What you have done has helped me a lot already. Since you have the whole program, you should either add your name to the copyrite or with your skill you could probally improve on it and release one on your own
My other question about putting the quote other places on the site, would I need to basically use all the code that would be in the block-Quotes.php file? and try to get it to load in the certian areas?
I am a trial and error person, so I ask alot of questions, I just try to be carefull not to abuse the help that I am getting. |
|
|
|
|
jakec
|
Posted:
Wed Jan 14, 2009 7:46 am |
|
I'll need to have a look at the code tonight, but be under no illusion than I am an expert, I am very much a trial and error person like you.
I am not too bothered about the copyright, the changes I made were minor and the module could probably do with a security check by one of the experts here. I am not saying that there is a problem, but I am not the person to say either way. |
|
|
|
|
gator81
|
Posted:
Wed Jan 14, 2009 2:09 pm |
|
I thank you for being humble, to me your trial and error are on such a higher level then myself. I would be happy just to have your level of skill, I would be someone then
Again, ty for your help and time you are putting into this. |
|
|
|
|
jakec
|
Posted:
Wed Jan 14, 2009 4:31 pm |
|
It's definitely possible to add the quotes to your header, but it would require some hacking of the theme you are using. I'm not a theme expert either, but some themes display the latest downloads, or web links in the footer and the principle is the same, just querying a different table in the database.
No problem, for some reason I've always enjoyed helping people. |
|
|
|
|
Palbin
|
Posted:
Wed Jan 14, 2009 5:01 pm |
|
This is the code that you need to insert in the given area. Now if you need to add a row or column to a table via html you would need to add that code, but if you are just entering it into an existing cell that this could should be fine. It is possible you could run into a conflict with the variables used in the sql statements, but probably not.
Code:
mt_srand((double)microtime()*1000000);
$quotesql = "SELECT COUNT(qid) FROM ".$prefix."_quotes";
$result = $db->sql_query($quotesql);
if ($result)
{
list($count) = $db->sql_fetchrow($result);
}
else
{
$count = 0;
}
if ($count < 1)
{
$content .= "There aren't enough quotes in the database right now.";
}
else
{
$index = 1;
if ($count > 1)
{
$index = mt_rand(0, ($count - 1));
}
$quotesql = "SELECT quote, author FROM ".$prefix."_quotes ORDER BY qid LIMIT " . sprintf("%d", ($index - 1)) . ", 1";
$result = $db->sql_query($quotesql);
if ($result)
{
list($quote, $author) = $db->sql_fetchrow($result);
$content .= "<b>" . $quote . "</b>";
if ($author != "")
{
$content .= "<br><br>";
$content .= "-- " . $author;
}
}
else
{
$content .= "A database error has occurred.";
}
}
|
|
|
|
|
|
Palbin
|
Posted:
Wed Jan 14, 2009 5:02 pm |
|
if you want to make this block xhtml compliant you need to change all the <br> tags to <br /> tags. Not a must, but just an option. |
|
|
|
|
gator81
|
Posted:
Thu Jan 15, 2009 1:17 am |
|
as time permits i will see what iit will do thanks |
|
|
|
|
jakec
|
Posted:
Thu Jan 15, 2009 1:23 am |
|
Good point Palbin, I should of checked for compliancy when I changed the DB layer. Doh |
|
|
|
|
|