Here it is, i just replaced the site name with similar pattern:
<?php
/**
*
* @author Streetspirit
*/
class NGSiteNameV2Mobile extends NGSiteNameV2Page {
public static $db = array(
// Header Links
'LoginLink' => 'Text',
'PlayNowLink' => 'Text',
'PromoValue'=>'Text',
// Games Section
'GameUrl1' => 'Text', 'GameCaption1' => 'Text',
'GameUrl2' => 'Text', 'GameCaption2' => 'Text',
'GameUrl3' => 'Text', 'GameCaption3' => 'Text',
'GameUrl4' => 'Text', 'GameCaption4' => 'Text',
'GameUrl5' => 'Text', 'GameCaption5' => 'Text',
'GameUrl6' => 'Text', 'GameCaption6' => 'Text',
'GameUrl7' => 'Text', 'GameCaption7' => 'Text',
'GameUrl8' => 'Text', 'GameCaption8' => 'Text',
'GameUrl9' => 'Text', 'GameCaption9' => 'Text',
'GameUrl10' => 'Text', 'GameCaption10' => 'Text',
'GameUrl11' => 'Text', 'GameCaption11' => 'Text',
'GameUrl12' => 'Text', 'GameCaption12' => 'Text',
// Footer content
'HelpLink' => 'Text',
'AboutUsLink' => 'Text',
'ContactLink' => 'Text'
);
public static $has_one = array(
'GameImage1' => 'Image',
'GameImage2' => 'Image',
'GameImage3' => 'Image',
'GameImage4' => 'Image',
'GameImage5' => 'Image',
'GameImage6' => 'Image',
'GameImage7' => 'Image',
'GameImage8' => 'Image',
'GameImage9' => 'Image',
'GameImage10' => 'Image',
'GameImage11' => 'Image',
'GameImage12' => 'Image'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Extras', new TextareaField('ExtraJavaScript', 'Extra Javascript:', 25, 10));
// HEADER TAB
$fields->addFieldToTab('Root.Content.Header', new TextField('LoginLink', 'Link for Login:'));
$fields->addFieldToTab('Root.Content.Header', new TextField('PlayNowLink', "Link for 'Play now' button:", null, null, null, 'NGSiteName'));
// 12 IMAGES, CAPTIONS AND URL'S TAB
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage1', 'Image 1', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl1', 'Url 1'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption1', 'Caption 1'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage2', 'Image 2', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl2', 'Url 2'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption2', 'Caption 2'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage3', 'Image 3', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl3', 'Url 3'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption3', 'Caption 3'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage4', 'Image 4', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl4', 'Url 4'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption4', 'Caption 4'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage5', 'Image 5', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl5', 'Url 5'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption5', 'Caption 5'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage6', 'Image 6', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl6', 'Url 6'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption6', 'Caption 6'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage7', 'Image 7', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl7', 'Url 7'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption7', 'Caption 7'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage8', 'Image 8', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl8', 'Url 8'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption8', 'Caption 8'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage9', 'Image 9', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl9', 'Url 9'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption9', 'Caption 9'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage10', 'Image 10', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl10', 'Url 10'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption10', 'Caption 10'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage11', 'Image 11', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl11', 'Url 11'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption11', 'Caption 11'));
$fields->addFieldToTab('Root.Content.Games', new ImageField('GameImage12', 'Image 12', null, null, null, 'NGSiteName'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameUrl12', 'Url 12'));
$fields->addFieldToTab('Root.Content.Games', new TextField('GameCaption12', 'Caption 12'));
// FOOTER LINKS
$fields->addFieldToTab('Root.Content.Footer', new TextField('AboutUsLink', "'About Us' URL"));
$fields->addFieldToTab('Root.Content.Footer', new TextField('HelpLink', "'Help' URL"));
$fields->addFieldToTab('Root.Content.Footer', new TextField('ContactLink', "'Contact Us' URL"));
return $fields;
}
}
class NGSiteNameV2Mobile_Controller extends NGSiteNameV2Page_Controller {
public static $allowed_actions = array(
);
public function init() {
parent::init();
// THEME CHANGE
SSViewer::set_theme('NGSiteNameV2');
// CSS for Casino Page
Requirements::themedCSS("mobile");
}
public function parAndAr() {
return new ArrayData(array(
// Twelve games URL's with PAR and AR appended
"ToPlayNow" => $this->appendParAndAr($this->PlayNowLink),
"ToGameUrl1" => $this->appendParAndAr($this->GameUrl1),
"ToGameUrl2" => $this->appendParAndAr($this->GameUrl2),
"ToGameUrl3" => $this->appendParAndAr($this->GameUrl3),
"ToGameUrl4" => $this->appendParAndAr($this->GameUrl4),
"ToGameUrl5" => $this->appendParAndAr($this->GameUrl5),
"ToGameUrl6" => $this->appendParAndAr($this->GameUrl6),
"ToGameUrl7" => $this->appendParAndAr($this->GameUrl7),
"ToGameUrl8" => $this->appendParAndAr($this->GameUrl8),
"ToGameUrl9" => $this->appendParAndAr($this->GameUrl9),
"ToGameUrl10" => $this->appendParAndAr($this->GameUrl10),
"ToGameUrl11" => $this->appendParAndAr($this->GameUrl11),
"ToGameUrl12" => $this->appendParAndAr($this->GameUrl12)
));
}
// Generic function that appends PAR and AR to the element passed as a parameter
public function appendParAndAr($element = '') {
$request = isset($_REQUEST) ? $_REQUEST : '';
$PAR = '';
$AR = '';
if (isset($request['PAR'])) {
if (($request['PAR'] != "")) {
$PAR = $request['PAR'];
} else {
$PAR = $_SERVER['HTTP_REFERER'];
}
}
if (isset($request['AR'])) {
if (($request['AR'] != "")) {
$AR = $request['AR'];
} else {
$AR = $_SERVER['HTTP_REFERER'];
}
}
if ((strpos($element, 'PAR=') === FALSE) && (strpos($element, '&AR=') === FALSE)) {
$element = $element . '&PAR=' . $PAR . '&AR=' . $AR;
} else {
$element = preg_replace("/(.+[&?]PAR=).*(&AR=).*/", '${1}'.$PAR.'${2}'.$AR, $element);
}
return $element;
}
}