Random Quote Mod

Support for PhpBB3. Post here to get help with any phpBB3 related issue here
There is no support here! Only Read Access!
Forum rules
In order the get any support, you will have to do following:
1. Use a describing title!
2. Describe your problem and what happened when the problem occured
3. Tell us what version of phpBB3 you are currently using.
Else your topic may be ignored or locked!
iheartbreakz
BBCoder II
BBCoder II
Posts: 21
Joined: 11 Apr 2010, 16:58

Random Quote Mod

Post 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? :(
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Random Quote Mod

Post by Stoker »

You know this mod is for phpBB version 2??
Board rules! No PM support
iheartbreakz
BBCoder II
BBCoder II
Posts: 21
Joined: 11 Apr 2010, 16:58

Re: Random Quote Mod

Post 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
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Random Quote Mod

Post by Stoker »

You will need to fit in the code to functions.php instead of index.php
Then it will work on all pages.
Board rules! No PM support
iheartbreakz
BBCoder II
BBCoder II
Posts: 21
Joined: 11 Apr 2010, 16:58

Re: Random Quote Mod

Post by iheartbreakz »

where can i fit it in functions.php
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Random Quote Mod

Post 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.
Board rules! No PM support
iheartbreakz
BBCoder II
BBCoder II
Posts: 21
Joined: 11 Apr 2010, 16:58

Re: Random Quote Mod

Post by iheartbreakz »

nevermind i put the code in functions.php and it worked ;)
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Random Quote Mod

Post by Stoker »

Please post up the solution, maybe others want to use it.
Board rules! No PM support
iheartbreakz
BBCoder II
BBCoder II
Posts: 21
Joined: 11 Apr 2010, 16:58

Re: Random Quote Mod

Post 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?
User avatar
Stoker
Site Admin
Site Admin
Posts: 3536
Joined: 12 May 2008, 23:26
BBCodes: 239
Favourite BBCode: Anipro
Favourite MOD: PrettyPhoto
Location: Denmark
Contact:

Re: Random Quote Mod

Post by Stoker »

I dont know how to fix it, but the error is telling that the file quotes.txt is missing.
Board rules! No PM support
Locked