vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   What does this do? (PHP question) (https://vborg.vbsupport.ru/showthread.php?t=59906)

rrottman 01-08-2004 03:08 PM

What does this do? (PHP question)
 
I am not new to PHP but can anybody try to explain what this code (extracted from register.php) in vB 3.0 RC2 actually does? Thanks in advance.

PHP Code:

$actiontemplates = array(
    
'requestemail' => array(
        
'activate_requestemail'
    
),
    
'none' => array(
        
'activateform'
    
)
); 


Xenon 01-08-2004 03:16 PM

the code just generates a multidimensional array

ie an array called action templates containing two arrays, called requestemail and none.

each of these arrays contains another entry.

the whole structure is used by vb3 to know which templates have to be cached :)

rrottman 01-08-2004 03:24 PM

Quote:

Originally Posted by Xenon
the code just generates a multidimensional array

ie an array called action templates containing two arrays, called requestemail and none.

each of these arrays contains another entry.

the whole structure is used by vb3 to know which templates have to be cached :)

Thanks for getting back to me.
So this means PHP create 1 array named $actiontemplates containing 2 array:

- none
- requestemail

"none" contains a single string "activateform" and "requestemail" contains a single string "activate_requestemail"

Is this correct?
How does a statement have to look to access one of the strings?

$actiontemplates=>none[0]

???
Sorry for asking possibly stupid newbie stuff...

Xenon 01-08-2004 03:29 PM

no, the request-email and the none are array keys, so to access one of the strings you have to use:

$actiontemplates['none'][0] :)

rrottman 01-08-2004 03:38 PM

Okay. So they are keys but their values are again, array. And I could possibly iterate through the with the following statement?

PHP Code:

foreach ($actiontemplates as $key_at => $value_at) {
    echo (
"$key_at<br>");
    foreach (
$value_at as $item) {
        echo (
"...$item<br>");
    }        



Xenon 01-08-2004 03:44 PM

yes, that should work :)

rrottman 01-08-2004 03:48 PM

Quote:

Originally Posted by Xenon
yes, that should work :)

I'm so glad talking to one of the - huh!! - Administrators of this site... :-)
I always wonder whether there would be an option for the vB team to sell some kind of developer network membership on top of the vB license. I would be willing to pay for it. As far as I have seen it in the past, almost everybody gets interested in changing style, editing templates and sooner or later in starting to hack (a nice word for developing, actually).

I strongly feel for some kind of developer documentation. Explaining the basic concepts. How everything ties together. The docs which come with vB2 are - IMHO - way too smallsized for what you need to really work with vB.

I wonder, is there any site out there trying to explain some of the basic concepts? I'm not thinking of a PHP tutorial. I more or less think of something like a concepts guide.

The .php files I've looked in so far (register.php, login.php) seem to follow some basic structure. Including some functions. Registering some templates. Etc. etc. but it's difficult to grasp the concept behind just from focussing on source files.

Do you know any resource? Maybe another thread?
Any hint?!

Xenon 01-08-2004 03:50 PM

well going through modification hints and tips should help you for the beginning.
Afaik, there is a better documentation planned for vb3, but i don't know how detailed that will be, so we have to wait for gold until we will know exactly :)


All times are GMT. The time now is 04:42 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.01840 seconds
  • Memory Usage 1,731KB
  • 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
  • (8)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