vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Limited PHP scripts functionality for templates v1.0 (https://vborg.vbsupport.ru/showthread.php?t=47282)

JohnWoo 01-01-2003 10:00 PM

Limited PHP scripts functionality for templates v1.0
 
Hello all !

Here is small funny hack (5 strings of new code only in one script :) That may help to bring more power to vb templates :)
Features:
- executing php scripts (with modified syntax) from templates. Changing\creating php variables from templates, conditional actions and database requests without editing scripts.
It is all :)

PS changes in 1.1
- normal php variables syntax (with $)
- added example of database request from template
- support for several PHP blocks in one template

Xenon 01-02-2003 07:16 PM

hey, looks nice :)

Dean C 01-02-2003 07:35 PM

Indeed this looks very nice.

But what if a template is called by more than one file?

- miSt

JohnWoo 01-02-2003 08:05 PM

then why not to use some condition checking #PHP_SELF in template code ?

DrkFusion 01-02-2003 08:37 PM

he got u there mist ;)
Looking nice JohnWooo
I will check it out when I get home

Velocd 01-02-2003 11:43 PM

Interesting, but for organizational methods I like to keep PHP separate from the templates :p

DrkFusion 01-03-2003 03:04 AM

Organizational?
Well I would use this in a case of when I am lazy to add 3 lines of code that do 1 thing one 1 page.

So it would be pretty useful in my caze :)

nuno 01-03-2003 03:45 AM

hmm seems not to be working correctly :(
I was trying to pull out the the filesize attachments
PHP Code:

~%#data = 'index.php';#id = filesize(#data);echo "Filesize for #data: (#id)"%~ 

It gets printed at left top corner page and not right after attachment :confused:

JohnWoo 01-03-2003 06:48 AM

It is "limited functionality". Remember? :) echo will not work - sorry :) Try to replace echo with return.

VeoMorphine 01-03-2003 03:54 PM

nice. we should release template mods with this(they might like this on www.vbulletintemplates.com to.

Xenon 01-03-2003 08:21 PM

@Velo: yeh, but sometimes this can be usefull to, if you just want to calculate some values (ppd directly in the template instead of the code)

The Prohacker 01-04-2003 08:45 PM

Hmm... The 1.1 zip seems to be empty...

JohnWoo 01-04-2003 09:19 PM

Updated :)
It downloads fine for me (and before it was fine too)

Brad 01-05-2003 12:18 AM

Quote:

Originally posted by VeoMorphine
nice. we should release template mods with this(they might like this on www.vbulletintemplates.com to.
We have our own wrapper that works from the phpinclude template. Its a bit more work to code with it but it keeps us from hacking files. We have many of the hacks here working with only the phpinclude.

JohnWoo 01-05-2003 07:00 AM

But phpinclude will be executed on any page of forum, and think that it is not good :)

Brad 01-05-2003 10:20 AM

Acully no. for example this would only be ran on index.php, The query it exucutes will only be done on that page, its ignored on all others.

PHP Code:

if (strpos($_SERVER['PHP_SELF'], 'index.php') != false)
{
   
$query='code here'



Chris M 01-05-2003 10:21 AM

Nice Idea;)

@Anime-loo - Wouldn't "$DB_site->query" be better?

Satan

JohnWoo 01-05-2003 10:42 AM

Yes. It is another way. But what if you need to execute some code inside some loop ? :) Think that for example calculating something different for each post on showthread.php must be impossible using phpinclude only...

Brad 01-05-2003 11:09 AM

Quote:

Originally posted by hellsatan
Nice Idea;)

@Anime-loo - Wouldn't "$DB_site->query" be better?

Satan

yes, i was only showing a example ;) this would be the correct useage if you where ganna show the result of the query on index.php

$query=$DB_site->query_frist

Xenon 01-05-2003 11:13 AM

also it's not good to expand the phpinclude template such a lot.
rembember it's loaded on everypage, also if everything is in an if-clause it has to be loaded and so on.


All times are GMT. The time now is 03:48 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01102 seconds
  • Memory Usage 1,748KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete