Page 1 of 2

Random Quote Mod

Posted: 21 Apr 2010, 00:03
by iheartbreakz

Code: Select all

##########################################################################################
    ## Hack Title:   Random Quotes
    ## Hack Version: 2.0
    ## Author:       Yo^Bam <yobam@linux.nu>
    ## Fixed by:     Acid <acid_junky@web.de
    ## Description:  Displays a random quote on your phpBB.
    ##
    ## Files To Edit:  index.php, index_body.tpl
    ## Included Files: quotes.txt
    ###########################################################################################
    ##
    ## quotes.txt goes in your phpBB root dir.
    ##
    ###########################################################################################
    ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
    ###########################################################################################

    #
    #-----[ OPEN /index.php ]------------------------------
    #

    #
    #-----[ FIND around line 262 ]-----------------------------------
    #

       $template->assign_vars(array(
             'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),

    #
    #-----[ REPLACE WITH ]-------------------------------------------
    #

       srand ((double) microtime() * 1000000);
       $zitate = file("quotes.txt");
       $i = count($zitate)-1;

          $template->assign_vars(array(
             'QUOTE' => $zitate[rand(0,$i)],
             'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),


    #
    #-----[ OPEN /templates/xxx/index_body.tpl ]------------------------------
    #

    #
    #-----[ ADD wherever you want ]-----------------------------------
    #

       <span class="gen">{QUOTE}</span>


    #
    #-----[ SAVE/CLOSE ALL FILES ]-----------------------------------
    # EoM
this is the mod for Random Quotes but it only displays on the index page :( i even put (QUOTE) on the overall header but still didnt work anyway to make it work on everypage? :(

Re: Random Quote Mod

Posted: 21 Apr 2010, 05:23
by Stoker
You know this mod is for phpBB version 2??

Re: Random Quote Mod

Posted: 21 Apr 2010, 22:40
by iheartbreakz
it works for phpbb 3.0.7 and even in phpbb2 it only showed on the index page anyway to make it like you can have it on every page

Re: Random Quote Mod

Posted: 22 Apr 2010, 06:45
by Stoker
You will need to fit in the code to functions.php instead of index.php
Then it will work on all pages.

Re: Random Quote Mod

Posted: 22 Apr 2010, 13:53
by iheartbreakz
where can i fit it in functions.php

Re: Random Quote Mod

Posted: 22 Apr 2010, 14:49
by Stoker
I dont know, but You can use this instead: viewtopic.php?f=4&t=309
Its a bbode but use the html part in the template.

Re: Random Quote Mod

Posted: 22 Apr 2010, 22:53
by iheartbreakz
nevermind i put the code in functions.php and it worked ;)

Re: Random Quote Mod

Posted: 23 Apr 2010, 06:53
by Stoker
Please post up the solution, maybe others want to use it.

Re: Random Quote Mod

Posted: 25 Apr 2010, 20:32
by iheartbreakz
i entered those lines in functions.php here:

Code: Select all

       srand ((double) microtime() * 1000000);
       $zitate = file("quotes.txt");
       $i = count($zitate)-1;

          $template->assign_vars(array(
        'QUOTE' => $zitate[rand(0,$i)],
		'SITENAME'						=> $config['sitename'],
		'SITE_DESCRIPTION'				=> $config['site_desc'],
		'PAGE_TITLE'					=> $page_title,
but now the problem is that the skin that i dont have the quotes on when i go on the acp login page it gives me this error

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4171: file(quotes.txt) [function.file]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4300: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4302: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4303: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4304: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
how do i fix it? any suggestions?

Re: Random Quote Mod

Posted: 25 Apr 2010, 21:29
by Stoker
I dont know how to fix it, but the error is telling that the file quotes.txt is missing.