Hi,
I asked this in a different section, but haven't received a reply in almost a week.
http://www.silverstripe.org/data-model-questions/show/21293
Since asking, I have modified it a bit, but still only works when refreshing the page.
I am trying to get a variable from various google location ads to change the phone number depending on the ?number=xxx from the ad.
Currently the number displays a default value unless the page is refreshed, then the variable is displayed.
I need it to display the number without the need for a refresh.
Is there a better way of doing this that will display the variable number without the need for a page refresh?
In page.ss
<% if phonenumber %>$phonenumber <% else %>0800 xxx xxx<% end_if %>
In page.php
public function Phonenumber() {
if (!isset($_SESSION['number']))
{
$phonenumber = $_GET['number'];
$_SESSION['number'] = $phonenumber;
}
return strip_tags (Session::get ('number'));
}
Any advice or pointers are massively appreciated.