phpBB

Development Wiki

Difference between revisions of "Function.append sid"

From phpBB Development Wiki

(Created page with 'append_sid -- Prepare a URL before sending it to the template ==Description== #<pre>stringrequest_var ( $url [, $get_params])</pre> Append sid is used whenever you send a link …')
 
m (Fixed typo)
 
(6 intermediate revisions by 4 users not shown)
Line 2: Line 2:
  
 
==Description==
 
==Description==
#<pre>stringrequest_var ( $url [, $get_params])</pre>
+
#<pre>string append_sid( $url [, $params = false [, $is_amp = true [, $session_id = false]]])</pre>
Append sid is used whenever you send a link to a template, including the action attribute value of html forms. This function will activlty determine whether a Session ID needs to be appended to the URL in order to preserve the current session.
+
Append sid is used whenever you send a link to a template, including the action attribute value of html forms. This function will actively determine whether a Session ID needs to be appended to the URL in order to preserve the current session.
  
 
==Parameters==
 
==Parameters==
Line 13: Line 13:
 
| The physical page being linked to.
 
| The physical page being linked to.
 
|-
 
|-
| '''get_params''' (string)
+
| '''params''' (mixed)
| All the parameters added to send variables via the GET method.
+
| All the parameters added to send variables via the GET method, can be a string or an array
 +
|-
 +
| '''is_amp''' (mixed)
 +
| Is url using &amp;amp; (true) or & (false)
 +
|-
 +
| '''session_id''' (mixed)
 +
| Possibility to use a custom session id instead of the global one
 
|}
 
|}
  
Line 22: Line 28:
 
==Examples==
 
==Examples==
 
<php>$template->assign_vars(array(
 
<php>$template->assign_vars(array(
'U_ACTION' => append_sid($phpbb_root_path.'viewtopic.'.$phpEx, 'f=69&t=1756785'),
+
'U_ACTION' => append_sid($phpbb_root_path.'viewtopic.'.$phpEx, 'f=69&amp;t=1756785'),
 +
));</php>
 +
The above creates the new template var 'U_ACTION'.
 +
 
 +
<php>$template->assign_vars(array(
 +
'U_ACTION' => append_sid($phpbb_root_path.'viewtopic.'.$phpEx, array('f' => 69, 't' => '1756785'),
 
));</php>
 
));</php>
 
The above creates the new template var 'U_ACTION'.
 
The above creates the new template var 'U_ACTION'.
Line 32: Line 43:
 
[[Category:Functions]]
 
[[Category:Functions]]
  
[[ja:append_sid]]
+
[[ja:Function.append_sid]]

Latest revision as of 06:03, 6 September 2012

append_sid -- Prepare a URL before sending it to the template

Description

  1. string append_sid( $url [, $params = false [, $is_amp = true [, $session_id = false]]])

Append sid is used whenever you send a link to a template, including the action attribute value of html forms. This function will actively determine whether a Session ID needs to be appended to the URL in order to preserve the current session.

Parameters

Parameter Usage
url (string) The physical page being linked to.
params (mixed) All the parameters added to send variables via the GET method, can be a string or an array
is_amp (mixed) Is url using &amp; (true) or & (false)
session_id (mixed) Possibility to use a custom session id instead of the global one

Return Values

Returns the URL string with the Session ID if needed.

Examples

$template->assign_vars(array(
    
'U_ACTION'    => append_sid($phpbb_root_path.'viewtopic.'.$phpEx'f=69&amp;t=1756785'),
));

The above creates the new template var 'U_ACTION'.

$template->assign_vars(array(
    
'U_ACTION'    => append_sid($phpbb_root_path.'viewtopic.'.$phpEx, array('f' => 69't' => '1756785'),
));

The above creates the new template var 'U_ACTION'.

See Also

reapply_sid Template_Syntax