Current Location: Home> Function Categories> output_add_rewrite_var

output_add_rewrite_var

Add URL rewriter value
Name:output_add_rewrite_var
Category:Output buffer control
Programming Language:php
One-line Description:Used to append query string parameters to any URL in the output.

Definition and usage

The output_add_rewrite_var() function adds variables to the URL in the HTML tag and the hidden input of the form. Which tags will be affected depends on the configuration of the url_rewriter.tags setting in php.ini.

Example

Add variable to the URL in the output:

 <?php
// Make URL rewriter affect <a href> and <form> tags
ini_set ( 'url_rewriter.tags' , 'a=href,form=' ) ;

// Add a variable
output_add_rewrite_var ( 'var' , 'value' ) ;

// Output a link and a form
echo '<a href="">This link\'s URL will have a variable</a>' ;
echo '<form>' ;
echo '<p>This form will have a hidden input</p>' ;
echo '<input type="text" name="hello">' ;
echo '</form>' ;
?>

Try it yourself

grammar

 output_add_rewrite_var ( name , value ) ;
parameter describe
name The name of the variable to be added to the URL, and the contents of the name attribute that hides the input in the form.
value The value of the variable to be added to the URL, and the contents of the value attribute that hides the input in the form.
Similar Functions