Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 10-17-2013, 03:47 AM
doob doob is offline
 
Join Date: Dec 2009
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default php merge of album.php into index.php

Am attempting a custom hack of displaying newest albums on FORUMHOME.

Step 1: copied and hacked album.php to new_album.php
Step 2: creaeted custom_album_list and custom_albumbit templates

All that remains now is display of 4 latest albums and /forums/new_album.php displays correctly.

Now I want to display this on the FORUMHOME page (i.e. index.php) but am a little stumped. I have tried the following methods unsuccessfully and wondering if anyone has some wisdom to share

1: Creating a plugin to include the new_album.php into FORUMHOME basically torched the site.

2: Merging new_album.php into index.php which led to function call errors

Is either 1 or 2 the right way to go and I just need to keep working it?
Reply With Quote
  #2  
Old 10-17-2013, 07:13 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd be better off writing a plugin/plugins/file to be included onto the home page to get the data. don't think you're going to get it to do what you want, the way you're doing it.
Reply With Quote
  #3  
Old 10-17-2013, 08:05 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How did you call your new_album.php in to your template?
Reply With Quote
  #4  
Old 10-17-2013, 08:59 AM
doob doob is offline
 
Join Date: Dec 2009
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Zachary that kind of sounds like what I've done. Created a file and am including it via plugin into forumhome. It just so happens the bit of code in that file came from album.php

Zachary and Simon I've tried using an includes plugin and then using that plugin in the FORUMHOME template, which has worked in the past for other hacks without problem, but for those others, it was always totally my own PHP, not something coined from the default files.

I think its this line that is buggering it up:
eval('print_output("' . fetch_template($templatename) . '");');

Just putting that line, all by itself, into a plugin and activating it screws up every page on the test site, which is interesting!

I'm exploring other ways to get that bit of functionality working.
Reply With Quote
  #5  
Old 10-17-2013, 09:57 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'd use something like this in your plugin to get the php file in to your template
PHP Code:
ob_start();
   include(
'new_album.php ');
   
$includedphp ob_get_contents();
ob_end_clean(); 
and then use the $includedphp variable in your plugin or template.
Reply With Quote
  #6  
Old 10-17-2013, 10:19 AM
doob doob is offline
 
Join Date: Dec 2009
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, that's exactly what I'm doing. The problem really is in this bit of php code:
eval('print_output("' . fetch_template('custom_album_list_fh') . '");');

In index.php that line of code looks like:
eval('print_output("' . fetch_template('FORUMHOME') . '");');

It seems you can't nest evals and I'm not quite sure at the moment of what the replacement for eval would be and I'll have to research both print_output and fetch_template to see how they figure in.

Maybe in the morning the answer will come to me...
Reply With Quote
  #7  
Old 10-18-2013, 02:49 PM
doob doob is offline
 
Join Date: Dec 2009
Posts: 127
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Success!

I turns out I just needed to replace the eval function with a bunch of echo statements containing the custom template within the php code.

Maybe a bit kludge but at least one measure of good code is that it works
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:29 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04221 seconds
  • Memory Usage 2,213KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete