Partial list of $context array (for [Unknown]s attention)

Started by Tyris, March 22, 2004, 12:23:21 AM

Previous topic - Next topic

Tyris

hmm... well I kinda offered to do this kinda... but its kinda hard given that the context array is different depending where you are in the forum...
But I've kinda listed some stuff... really I'd like to help out document this some more... if [Unknown] would like at least... though I'm a little stuck for a good way to lay it out... per template is probably a good idea... ^^ but I dont really know which tempates have what info... so here's a big stack of it anyway...
with some of it annotated just to see if thats whats wanted... hope it helps in some way... ^^

[context] => Array
(
    [user] => Array # Array with the users basic information...
        (
            [id] => # The User's ID
            [is_logged] => 1
            [is_guest] => # The user is a guest? (blank or '1')
            [is_admin] => # The user is an admin? (blank or '1')
            [is_mod] => # The user is a mod? (blank or '1') (is this forum relative??? or overall??)
            [username] => # Login name
            [name] => # The name others see.
            [language] => # Language the user has set (eg: english)
            [email] => # Users email address
            [is_owner] => # To do with owning the profile? (1 means you are the owner, blank means you are not...?)
            [messages] => # Total Messages
            [unread_messages] => # Total unread messages
            [avatar] => Array
                (
                    [href] => # The html location of their image (eg: http://www.domain etc)
                    [image] => # The html image code to display it (eg: <img src="http: etc)
                )

            [total_time_logged_in] => Array # Self explanetory...
                (
                    [days] => 0
                    [hours] => 0
                    [minutes] => 9
                )

        )

    [linktree] => Array # contains link tree info...
        (
            [0] => Array # each [number] is a level of the tree...
                (
                    [url] => http://192.168.0.3/smf/index.php
                    [name] => Test Community
                )

            [1] => Array # categorie
                (
                    [url] => http://192.168.0.3/smf/index.php#1
                    [name] => General Category
                )

            [2] => Array # board. Note: seems to contain "moderators" only if
                (
                    [url] => http://192.168.0.3/smf/index.php?board=1.0
                    [name] => General Discussion
                    [moderators] => Array
                        (
                            [1] => Array # one for each mod...
                                (
                                    [id] => 1
                                    [name] => Tyris
                                    [href] => http://192.168.0.3/smf/index.php?action=profile;u=1
                                    [link] => <a href="http://192.168.0.3/smf/index.php?action=profile;u=1" title="">Tyris</a>
                                )

                        )

                )

            [3] => Array # this one is a child board...
                (
                    [url] => http://192.168.0.3/smf/index.php?board=2.0
                    [name] => New Board
                )

        )

    [html_headers] =>
    [menu_separator] => # The menu seperator (eg: ' ' or ' | ')
    [session_id] => # The users current session ID
    [forum_name] => # Your forum's name.
    [browser] => Array # Extra info about browser to help format HTML properly.
        (
            [is_opera] =>
            [is_opera6] =>
            [is_ie4] =>
            [is_safari] =>
            [is_gecko] =>
            [is_ie6] => 1
            [is_ie5] =>
            [is_ie] => 1
            [needs_size_fix] =>
        )

    [template_layers] => Array # no idea...
        (
            [0] => main
        )

    [character_set] => # The character set (eg: ISO-8859-1)
    [right_to_left] => # Whether the forum should be LTR or RTL (a 1 or blank ??)
    [categories] => Array
        (
            [1] => Array
                (
                    [id] => 1
                    [name] => General Category
                    [is_collapsed] =>
                    [can_collapse] => 1
                    [boards] => Array
                        (
                            [1] => Array
                                (
                                    [new] => 1
                                    [id] => 1
                                    [name] => General Discussion
                                    [description] => Feel free to talk about anything and everything in this board.
                                    [moderators] => Array
                                        (
                                        )

                                    [link_moderators] => Array
                                        (
                                        )

                                    [children] => Array
                                        (
                                            [2] => Array
                                                (
                                                    [id] => 2
                                                    [name] => New Board
                                                    [description] =>
                                                    [new] => 0
                                                    [topics] => 0
                                                    [posts] => 0
                                                    [href] => http://192.168.0.3/smf/index.php?board=2.0
                                                    [link] => <a href="http://192.168.0.3/smf/index.php?board=2.0">New Board</a>
                                                    [last_post] => Array
                                                        (
                                                            [id] =>
                                                            [timestamp] =>
                                                            [time] => N/A
                                                            [subject] =>
                                                            [member] => Array
                                                                (
                                                                    [id] => 0
                                                                    [username] => N/A
                                                                    [name] =>
                                                                    [href] =>
                                                                    [link] => N/A
                                                                )

                                                            [start] => new
                                                            [topic] =>
                                                            [href] =>
                                                            [link] => N/A
                                                        )

                                                )

                                        )

                                    [link_children] => Array
                                        (
                                            [0] => <a href="http://192.168.0.3/smf/index.php?board=2.0">New Board</a>
                                        )

                                    [children_new] => 0
                                    [topics] => 1
                                    [posts] => 1
                                    [href] => http://192.168.0.3/smf/index.php?board=1.0
                                    [link] => <a href="http://192.168.0.3/smf/index.php?board=1.0">General Discussion</a>
                                    [last_post] => Array
                                        (
                                            [id] => 1
                                            [timestamp] => 1079931264
                                            [time] => <b>Today</b> at 03:54:24pm
                                            [subject] => Welcome to SMF!
                                            [member] => Array
                                                (
                                                    [id] => 0
                                                    [username] => Simple Machines Team
                                                    [name] => Simple Machines Team
                                                    [href] =>
                                                    [link] => Simple Machines Team
                                                )

                                            [start] => new
                                            [topic] => 1
                                            [href] => http://192.168.0.3/smf/index.php?topic=1.new;boardseen#new
                                            [link] => <a href="http://192.168.0.3/smf/index.php?topic=1.new;boardseen#new" title="Welcome to SMF!">Welcome to SMF!</a>
                                        )

                                )

                            [4] => Array
                                (
                                    [new] =>
                                    [id] => 4
                                    [name] => Non-child board
                                    [description] =>
                                    [moderators] => Array
                                        (
                                        )

                                    [link_moderators] => Array
                                        (
                                        )

                                    [children] => Array
                                        (
                                        )

                                    [link_children] => Array
                                        (
                                        )

                                    [children_new] =>
                                    [topics] => 0
                                    [posts] => 0
                                    [href] => http://192.168.0.3/smf/index.php?board=4.0
                                    [link] => <a href="http://192.168.0.3/smf/index.php?board=4.0">Non-child board</a>
                                    [last_post] => Array
                                        (
                                            [id] =>
                                            [timestamp] =>
                                            [time] => N/A
                                            [subject] =>
                                            [member] => Array
                                                (
                                                    [id] => 0
                                                    [username] => N/A
                                                    [name] =>
                                                    [href] =>
                                                    [link] => N/A
                                                )

                                            [start] => new
                                            [topic] =>
                                            [href] =>
                                            [link] => N/A
                                        )

                                )

                        )

                    [new] => 1
                )

            [2] => Array
                (
                    [id] => 2
                    [name] => New Category
                    [is_collapsed] =>
                    [can_collapse] => 1
                    [boards] => Array
                        (
                            [5] => Array
                                (
                                    [new] =>
                                    [id] => 5
                                    [name] => New Board
                                    [description] =>
                                    [moderators] => Array
                                        (
                                        )

                                    [link_moderators] => Array
                                        (
                                        )

                                    [children] => Array
                                        (
                                        )

                                    [link_children] => Array
                                        (
                                        )

                                    [children_new] =>
                                    [topics] => 0
                                    [posts] => 0
                                    [href] => http://192.168.0.3/smf/index.php?board=5.0
                                    [link] => <a href="http://192.168.0.3/smf/index.php?board=5.0">New Board</a>
                                    [last_post] => Array
                                        (
                                            [id] =>
                                            [timestamp] =>
                                            [time] => N/A
                                            [subject] =>
                                            [member] => Array
                                                (
                                                    [id] => 0
                                                    [username] => N/A
                                                    [name] =>
                                                    [href] =>
                                                    [link] => N/A
                                                )

                                            [start] => new
                                            [topic] =>
                                            [href] =>
                                            [link] => N/A
                                        )

                                )

                        )

                    [new] => 0
                )

        )

    [users_online] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [username] => Tyris
                    [name] => Tyris
                    [group] => 1
                    [href] => http://192.168.0.3/smf/index.php?action=profile;u=1
                    [link] => <a href="http://192.168.0.3/smf/index.php?action=profile;u=1" style="color: #FF0000;">Tyris</a>
                )

        )

    [list_users_online] => Array
        (
            [0] => <a href="http://192.168.0.3/smf/index.php?action=profile;u=1" style="color: #FF0000;">Tyris</a>
        )

    [num_guests] => 0
    [num_users_hidden] => 0
    [num_users_online] => 1
    [latest_member] => Array
        (
            [name] => Tyris
            [id] => 1
            [href] => http://192.168.0.3/smf/index.php?action=profile;u=1
            [link] => <a href="http://192.168.0.3/smf/index.php?action=profile;u=1">Tyris</a>
        )

    [latest_post] => Array
        (
            [id] => 1
            [timestamp] => 1079931264
            [time] => <b>Today</b> at 03:54:24pm
            [subject] => Welcome to SMF!
            [member] => Array
                (
                    [id] => 0
                    [username] => Simple Machines Team
                    [name] => Simple Machines Team
                    [href] =>
                    [link] => Simple Machines Team
                )

            [start] => new
            [topic] => 1
            [href] => http://192.168.0.3/smf/index.php?topic=1.new;boardseen#new
            [link] => <a href="http://192.168.0.3/smf/index.php?topic=1.new;boardseen#new" title="Welcome to SMF!">Welcome to SMF!</a>
        )

    [show_stats] => 1
    [show_member_list] => 1
    [show_who] => 1
    [show_login_bar] =>
    [show_calendar] =>
    [page_title] => Test Community - Index
    [news_lines] => Array
        (
            [0] => SMF - Just Installed
        )

    [fader_news_lines] => Array
        (
            [0] => SMF - Just Installed
        )

    [random_news_line] => SMF - Just Installed
    [unapproved_members] => 0
    [allow_search] => 1
    [allow_admin] => 1
    [allow_edit_profile] => 1
    [allow_calendar] =>
    [allow_pm] => 1
    [in_maintenance] =>
    [current_time] => March 22, 2004, 04:04:20 pm
    [show_vBlogin] =>
    [show_news] => 1
)

Tyris

the above is kinda hard to read due to side scroll... so maybe copy to clipboard ;)


additionally another possibly useful array... tho I'm not really sure is:


[modSettings] => Array
(
    [smfVersion] => 1.0 Beta 4 Public
    [news] => SMF - Just Installed
    [compactTopicPagesContiguous] => 5
    [compactTopicPagesEnable] => 1
    [enableStickyTopics] => 1
    [todayMod] => 1
    [karmaMode] => 0
    [karmaTimeRestrictAdmins] => 1
    [enablePreviousNext] => 1
    [PreviousNext_back] => &laquo; previous
    [PreviousNext_forward] => next &raquo;
    [pollMode] => 1
    [enableVBStyleLogin] => 1
    [enableCompressedOutput] => 0
    [karmaWaitTime] => 1
    [karmaMinPosts] => 0
    [karmaLabel] => Karma:
    [karmaSmiteLabel] => [smite]
    [karmaApplaudLabel] => [applaud]
    [attachmentSizeLimit] => 128
    [attachmentDirSizeLimit] => 10240
    [attachmentUploadDir] => C:/Program Files/Apache Group/Apache2/htdocs/smf/attachments
    [attachmentExtensions] => txt,jpg,gif,pdf,mpg,png
    [attachmentCheckExtensions] => 1
    [attachmentShowImages] => 1
    [attachmentEnable] => 1
    [attachmentEncryptFilenames] => 1
    [disableCaching] => 0
    [censorWholeWord] => 0
    [censorIgnoreCase] => 1
    [mostOnline] => 1
    [mostOnlineToday] => 1
    [mostDate] => 1079931637
    [notifyAnncmnts_UserDisable] => 1
    [viewNewestFirst] => 0
    [trackStats] => 1
    [hitStats] => 0
    [userLanguage] => 1
    [titlesEnable] => 1
    [topicSummaryPosts] => 15
    [enableReportToMod] => 1
    [enableErrorLogging] => 1
    [maxwidth] => 0
    [maxheight] => 0
    [onlineEnable] => 0
    [topbottomEnable] => 0
    [cal_holidaycolor] => 000080
    [cal_bdaycolor] => 920AC4
    [cal_eventcolor] => 078907
    [cal_todaycolor] => C1E5FF
    [cal_enabled] => 0
    [cal_maxyear] => 2010
    [cal_minyear] => 2002
    [cal_daysaslink] => 0
    [cal_startmonday] => 0
    [cal_defaultboard] =>
    [cal_showeventsonindex] => 0
    [cal_showbdaysonindex] => 0
    [cal_showholidaysonindex] => 0
    [cal_captioncolor] => FFFFFF
    [cal_showweeknum] => 0
    [cal_allowspan] => 0
    [cal_maxspan] => 7
    [smtp_host] =>
    [smtp_username] =>
    [smtp_password] =>
    [mail_type] => sendmail
    [timeLoadPageEnable] => 0
    [totalTopics] => 1
    [totalMessages] => 1
    [removeNestedQuotes] => 0
    [simpleSearch] => 0
    [localCookies] => 0
    [censor_vulgar] =>
    [censor_proper] =>
    [enablePostHTML] => 0
    [theme_allow] => 1
    [theme_default] => 1
    [theme_guests] => 1
    [enableEmbeddedFlash] => 0
    [xmlnews_enable] => 1
    [xmlnews_maxlen] => 255
    [registration_disabled] => 0
    [hotTopicPosts] => 15
    [hotTopicVeryPosts] => 25
    [globalCookies] => 0
    [securityDisable] => 0
    [send_validation] => 0
    [send_validation_onChange] => 0
    [send_welcomeEmail] => 1
    [allow_hideEmail] => 1
    [guest_hideEmail] => 0
    [spamWaitTime] => 5
    [reserveWord] => 0
    [reserveCase] => 1
    [reserveUser] => 1
    [reserveName] => 1
    [reserveNames] => Admin
Webmaster
    [autoLinkUrls] => 1
    [banLastUpdated] => 0
    [avatar_allow_server_stored] => 1
    [avatar_directory] => C:/Program Files/Apache Group/Apache2/htdocs/smf/avatars
    [avatar_url] => http://192.168.0.3/smf/avatars
    [avatar_allow_external_url] => 1
    [avatar_max_height_external] => 65
    [avatar_max_width_external] => 65
    [avatar_check_size] => 0
    [avatar_action_too_large] => option_html_resize
    [avatar_allow_upload] => 0
    [avatar_max_height_upload] => 65
    [avatar_max_width_upload] => 65
    [avatar_resize_upload] => 1
    [failed_login_threshold] => 3
    [enableSpellChecking] => 1
    [queryless_urls] => 0
    [edit_wait_time] => 90
    [autoFixDatabase] => 1
    [allow_guestAccess] => 1
    [time_format] => %B %d, %Y, %I:%M:%S %p
    [enableBBC] => 1
    [max_messageLength] => 20000
    [max_signatureLength] => 300
    [autoOptDatabase] => 7
    [autoOptMaxOnline] => 0
    [autoOptLastOpt] => 1079931283
    [defaultMaxMessages] => 15
    [defaultMaxTopics] => 20
    [defaultMaxMembers] => 30
    [enableParticipation] => 1
    [recycle_enable] => 0
    [recycle_board] => 0
    [maxMsgID] => 1
    [enableAllMessages] => 0
    [fixLongWords] => 0
    [knownThemes] => 1,2
    [who_enabled] => 1
    [time_offset] => 0
    [cookieTime] => 60
    [lastActive] => 15
    [smiley_sets_enable] => 0
    [smiley_sets_known] => default
    [smiley_sets_names] => Default
    [smiley_sets_default] => default
    [smiley_enable] => 1
    [modlog_enabled] => 1
    [cal_days_for_index] => 7
    [requireAgreement] => 1
    [unapprovedMembers] => 0
    [approve_registration] => 0
    [default_personalText] =>
    [smileys_url] => http://192.168.0.3/smf/Smileys
    [latestMember] => 1
    [latestRealName] => Tyris
    [memberCount] => 1
    [mostOnlineUpdated] => 20040322
)

[Unknown]

Okay, maybe this will help...

user is global. (all templates.)
linktree is global but changes.
html_headers is global.
menu_separator I plan to probably remove, global.
session_id global.
forum_name global.
browser is global.
template_layers global, these are the layers used on the current page view.
character_set global.
right_to_left, true or false. (it prints as 1 or blank.)

categories, users_online, list_users_online, num_guests, num_users_hidden, num_users_online, latest_member, latest_post, show_stats, show_member_list, show_who, show_login_bar, show_calendar - all local to the BoardIndex template, main sub template.

page_title is the current page's title - global.
news_lines is global, it's the different news items.
fader_news_lines are global lines for easy javascript use.
random_news_line is a pre chosen random news line, global.
unapproved_members is only set if you can see it, but it's global.
allow_search, allow_admin, allow_edit_profile, allow_calendar, and allow_pm are all global.
in_maintenance is global... whether its in maintenace mode.
current_time is global, current time formatted by user's preferences.
show_vBlogin is whether to show the vB-style login - global.
show_news also global.... self explanatory.

-[Unknown]

Tyris

ok, cool... um... I'll keep working...
how about an xml kinda thing... simplistic...
aarg... would attach but cant!! >< silly people :P
hold on... will upload... :P

http://www.nintengu.net/context.xml

like that...? I've never used xml ... soo.... :-[
is there anyway to make the 'expandable' bits start closed...? and is there anyway to put a # or a digit in the <> signs...?
Also... how about for the stuff thats relevant ONLY to a certain template we have <that_element relevance=whatever_template> ?? everything else being considered global...?

also, in the user part.... "is_owner" doesnt seem to be global... ;)

anyway... let me know what you think... and feel free to say "Tyris... you're an idiot... dont do this" or whatever... myeh... ^^
* Tyris just wants to help
;D

[Unknown]

Hmm, is_logged is "are they logged in?", is_mod - is the user a moderator of the current board?

None of them are 1/blank - they are true/false.  Printing them with print_r just shows 1 or blank.

Yeah, is_owner isn't totally global.

Not sure if xml is the best way for this, but maybe.

-[Unknown]

Tyris

ok, well... if you've got a better suggestion (which I'm assuming you probably do ;)) that I could help with or something... let me know :)
is_logged I wasnt sure if it was "logged in" or "has been logged" (as in for time, and the online users etc).
I thought excel might be good coz you can expand/minimise parts... which I thought was a reasonably nice way of showing the lower level arrays... just annoying that it starts all open... ><

[Unknown]

That's just Internet Explorer's default stylesheet.  I could do anything with the raw data.

-[Unknown]

Tyris

well, like I said... I know nothing about XML ;)
but anyway... if you want me to actally continue writing the stuff up... I'll be happy to... any more guidelines you want me to follow just let me know...

Daniel D.

Any chance to get an actual  list of all arrays that can be used in the/a specific template file(s)?

shanks

Is there any special way for referencing $context?

For instance, $context['user']['id'] returns a value of '0' for me.

[Unknown]

In what context (unintentional pun) are you using it?

var_dump($context['user']['id']);

Does that show an int, with the value of 0?  Are you using SSI or is this within the forum?

-[Unknown]

shanks

Peculiar... It's working now. Maybe it had something to do with $_REQUEST?

I was/am using $context in the condition of an if statement. Maybe there were difficulties because this is all taking place in a pop-up window.

OvermindDL1

For note, XML has style sheets similier to css for html, xml's is called xsl or something like that.  It can be used to format xml however you want.

kaamaru

Thank you very much for this post :). I was wondering what elements the user array included.

Advertisement: