Hi,
I’m in the process of creating templates in EE (2.1) and I’m running into difficulty because I want to use some custom PHP within my EE templates.
I’m getting the following error:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: grid
Filename: libraries/Functions.php(640) : eval()'d code
Line Number: 4The code I’m trying to place within my EE templates is:
<?php
$poster_classes = array ('lifted','helvetica','kcaco','eboy','haters');
$show_grid = $_GET['grid'];
require("./utils/css_browser_selector.php");
?>I believe it’s related to using the $_GET (removing it doesn’t produce an error). I think its because grid is not on the querystring. Is that true?
Essentially I want to do something like:
User types in: http://airfront.co.uk/?grid=1
<?php
if($show_grid == "1") {
require_once("./utils/grid/grid.php");
}
?>That grid.php will just spit some mark-up on the page.
Any help much appreciated!
Cheers, - Paul.
Moved to Development and Programming by Moderator
Paul,
use $this->EE->input->get(‘grid’); It will evaluate to FALSE if it doesn’t exist.
Honestly, I wouldn’t use requires and addtional PHP in your templates. Build a plugin to move all the logic to.
-greg
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.