Jump to content

Recommended Posts

I have a php function in functions.php

function func_page_layout(){
$uri = $_GET['uri'];
if($uri == ""){
	$uri = "home";
} else {
	$uri = $uri;
};
$mysqli = func_db_connect();
$qry = "SELECT * FROM `pages` WHERE `uri`='$uri' LIMIT 1";
$result = $mysqli->query($qry, MYSQLI_STORE_RESULT);
$array = mysqli_fetch_array($result);
	$layout = $array['layout'];
require_once('themes/default/layouts/layout001.php');
};

 

now this is not working

 

but if in the page instead of executing the function I do the include straight out it works, any ideas?

 

the PHP error code(s)

Warning: require_once(themes/default/layouts/layout001.php) [function.require-once]: failed to open stream: No such file or directory in C:\inetpub\wwwroot\_inc\functions.php on line 148

Fatal error: require_once() [function.require]: Failed opening required 'themes/default/layouts/layout001.php' (include_path='c:\php\includes') in C:\inetpub\wwwroot\_inc\functions.php on line 148

 

Line #148 is

require_once('themes/default/layouts/layout001.php');

Link to comment
https://forums.phpfreaks.com/topic/186644-require-error-in-a-function/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.