Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » variable from google ads only works on page refersh

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 314 Views
  • neilos
    Community Member
    19 Posts

    variable from google ads only works on page refersh Link to this post


    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.

    The number displays a default value unless the page is refreshed, then the variable is displayed.

    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() {
    return strip_tags (Session::get ('number'));

    And defines.php


    if (!isset($_SESSION)) {
    if (!isset($_SESSION['number']))
    $phonenumber = $_GET['number'];
    $_SESSION['number'] = $phonenumber;


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.