1
cardo
Need Help With Random Quote Module
  • 2003/7/9 5:46

  • cardo

  • Just popping in

  • Posts: 8

  • Since: 2003/5/22


Hi All,

I am in the process of getting my site ready to go live and am trying to get the basic layout complete before getting all of the content done.

Please take a look athttp://www.beavercheese.com/bc for how it looks so far.

What I would like is to be able to print a random quote in the spot where you see the text, "Random Quote Module Text Here" on my site. When I was looking at PostNuke it was easy to do this, but I am still in my infancy when it comes to learning XOOPS.

In essence I want only text in quotes with no author. Essentially this is just going to be a random tagline for the site. Any help would be greatly appreciated.

Thanks,

Rich

2
lykoszine
Re: Need Help With Random Quote Module
  • 2003/7/9 9:37

  • lykoszine

  • Module Developer

  • Posts: 244

  • Since: 2002/1/2 2


Have you tried the module available in Modules/Themes here?

If you have, then all you need to do is add quotes from the Module Admin.

You can probably edit the template to remove the author also.

If you have not tried the module, then I suggest you do so... as it may fix your problem

3
YourHelp
Re: Need Help With Random Quote Module
  • 2003/7/9 12:10

  • YourHelp

  • Friend of XOOPS

  • Posts: 479

  • Since: 2003/6/9 6


Great Looking site ..

4
cardo
Re: Need Help With Random Quote Module
  • 2003/7/9 16:10

  • cardo

  • Just popping in

  • Posts: 8

  • Since: 2003/5/22


Thanks Lykoszine,

I will take a look at editing the template. I have the module installed already. I guess the problem is getting it to display in that location because it isn't within any of the normal layout locations. I know that with PostNuke and Autotheme you can put modules/blocks in non-standard locations. I will see if I can do the same with XOOPS.

5
cardo
Re: Need Help With Random Quote Module
  • 2003/7/9 16:12

  • cardo

  • Just popping in

  • Posts: 8

  • Since: 2003/5/22


Thanks YourHelp. I have a lot more work to go before it is ready though. :)

6
lykoszine
Re: Need Help With Random Quote Module
  • 2003/7/9 17:49

  • lykoszine

  • Module Developer

  • Posts: 244

  • Since: 2002/1/2 2


Sorry mate, completely ignored your main problem.

Here is a suggestion:

1 - open the blocks file in /modules/randomquotes/blocks (not sure about the dir name)

2 - At the end of the block, instead of the
return $block;
use

$tpl->assign("quote", $thevariablewhere_the_quote_is_stored);

Then in your theme.html, just use <{$quote}> where you want it
(you will need to activate the block as a left block visible to all, but hopefully nothing will display cos it will be empty. Ah, better return an empty '';)

7
cardo
Re: Need Help With Random Quote Module
  • 2003/7/9 19:34

  • cardo

  • Just popping in

  • Posts: 8

  • Since: 2003/5/22


Thanks lykoszine,

I tried that and when I make the change I only get a blank page in the browser. The code looks like this.

Quote:

<?php
// ------------------------------------------------------------------------ //
// Random Quotes Module for //
// XOOPS - PHP Content Management System 2.0 //
// VersiĆ³n 1.0.0 //
// Copyright (c) 2002 Mario Figge //
//http://www.zona84.com //
// ------------------------------------------------------------------------- //

/******************************************************************************
* Function: random_quote_show
* Input : void
* Output : $texto: Text of the quote
$autor: Autor of the quote
******************************************************************************/
function random_quote_show() {
global $xoopsDB;
$block = array();
$result = $xoopsDB->query("SELECT count(*) FROM ".$xoopsDB->prefix("citas"));
list($total_rows) = $xoopsDB->fetchRow($result);
$x = rand(1,$total_rows);
$result = $xoopsDB->query("SELECT texto, autor FROM ".$xoopsDB->prefix("citas")." WHERE id=".$x);
list($texto, $autor)= $xoopsDB->fetchRow($result);
$block['texto']=$texto;
$block['autor']=$autor;
return $block;
}

?>


What I did was replaced "return $block;" with $tpl->assign("quote", $texto);

I confirmed it was activated and then put <{$texto}> in the cell where I wanted it and now I get a blank page. If I switch back to the original Random Quote template it works ok but displays in the left block. Am I doing something wrong? :)

Thanks again for your help.

8
lykoszine
Re: Need Help With Random Quote Module
  • 2003/7/9 19:54

  • lykoszine

  • Module Developer

  • Posts: 244

  • Since: 2002/1/2 2


For a start, you need to be using <{$quote}>, not text in the template.

Also enable Smarty Error, in preferences, and check that $quote is there, with the correct value.

9
cardo
Re: Need Help With Random Quote Module
  • 2003/7/9 20:18

  • cardo

  • Just popping in

  • Posts: 8

  • Since: 2003/5/22


I should have said it in my last message but I tried both $texto and $quote. I will enable Smarty Error in preferences to see what it comes back with. I will post the results shortly.

[UPDATE]

Turning on Smarty Debugging worked when I didn't have the modified random quotes template in place, but as soon as I made the change I get the blank page and no pop up with the smarty variables listed as before. :(


Thanks again,

Rich

10
cardo
Re: Need Help With Random Quote Module
  • 2003/7/9 22:34

  • cardo

  • Just popping in

  • Posts: 8

  • Since: 2003/5/22


After further testing the line that causes the blank page to be displayed is:

$tpl->assign("quote", $texto);

If I comment this line out it my page displays as normal, without the random quote of course. I have two quotes in my database and the quotes display fine in the left block if I use one of the other themes. I am at a loss as to what is causing this to fail.


Login

Who's Online

185 user(s) are online (121 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits