Description Parser

From Easy PHP Calendar Instructions
Jump to: navigation, search

With the Parser option enabled in Settings, certain user fields can be parsed in the description area of an event when displayed in pop-ups and the agenda calendar.

The fields that can be parsed and their results are below:


[date]

The date that was clicked

[jdate]

The Julian day number of event

[time]

The start time of the event

[timeend]

The end time of the event

[shortdescr]

The short description of the event

[eid]

Unique internal event identifier


This is useful for creating links to other pages where you may need to pass these variables.

Example: http://www.YourDomainName.com/booking.php?date=[date]&time=[time]&descr=[shortdescr]

If you want to have a script that then extracts the values out of the URL, use the $_GET or $_REQUEST global variables of PHP.

If the goal is to populate an entry form, then here's what to do...

Based on a link with "?date=[date]&time=[time]&descr=[shortdescr]", at the top of a page (the entry form) have this:

<?php
$date = $_GET['date'];
$time = $_GET['time'];
$descr = $_GET['descr'];
?>

where this is in format $myVariable = $_GET['value_of_what's_before_the_equal_sign_in_url'];

You can use any of the parser variables available listed above.

After this, you'll want to populate a form... do so by following this format:

<input type="text" name="myVariable" value="<?php echo $myVariable; ?>">

Replace "myVariable" at both spots with whichever variable you want to use that were retrieved at the top of the script. Of course, you can add all of the regular options that <input> tags have, like size, maxlength, class, etc...

To prevent XSS attacks, it is strongly recommended that before displaying these variables in your pages, check that they are in the format you are expecting or use PHP html_entities to convert the variables to make them safer to display.