Included in another script
Started by Mike, Apr 20 2012 04:14 AM
13 replies to this topic
#3
Posted 23 April 2012 - 03:00 AM
Thanks! but I have solved the problem.
Now me a new problem to include the following lines:
require_once("pw/index.php");
.
.
.
$this->data['cms'] = $wire->pages->get("/about/what/");
My page says:
The page you requested cannot be found!
Surely I`ve missed some step.
Thanks!
Now me a new problem to include the following lines:
require_once("pw/index.php");
.
.
.
$this->data['cms'] = $wire->pages->get("/about/what/");
My page says:
The page you requested cannot be found!
Surely I`ve missed some step.
Thanks!
#4
Posted 23 April 2012 - 12:03 PM
require_once("pw/index.php");
This may not be a safe inclusion because it's not specific enough. It's going to search all of PHP's paths for a "pw" dir before it searches the current dir. So be sure to complete that to a absolute or relative path. Absolute meaning a full "/path/to/pw/index.php" or relative meaning one that starts with a dot, i.e. "./pw/index.php" or "./index.php" or whatever it is relative to your PW installation.
Also, for your API call, I suggest using wire('pages')->get() rather than $wire->pages->get().
#7
Posted 25 April 2012 - 07:22 AM
Ok Ryan, my problem is that I have included this code in my phpprogram through a controller.
<?php
class ControllerCommonCMS extends Controller {
public function index() {
//includes the path that contains the variable
require_once("pw/index.php");
//mypage contains the page
$mypage = wire('pages')->get("/ourguarantee");
}
}
?>
I have to do to display the page?
Thanks!
<?php
class ControllerCommonCMS extends Controller {
public function index() {
//includes the path that contains the variable
require_once("pw/index.php");
//mypage contains the page
$mypage = wire('pages')->get("/ourguarantee");
}
}
?>
I have to do to display the page?
Thanks!
#9
Posted 26 April 2012 - 03:23 AM
Thank you very much Ryan!
Now it has emerged the following problem:
Error Uncaught exception 'WireException' with message 'Page /ccsMA/ourguarantee/ may not be rendered because outputFormatting is set to false
But i have solved including:
Now it show the fields but without the template format and images.
Why can this be?
Now it has emerged the following problem:
Error Uncaught exception 'WireException' with message 'Page /ccsMA/ourguarantee/ may not be rendered because outputFormatting is set to false
But i have solved including:
wire('pages')->setOutputFormatting(true);
Now it show the fields but without the template format and images.
Why can this be?
#11
Posted 26 April 2012 - 04:52 PM
I would guess that you're assets css and images arent loading because you installed PW in a subdirectory. When you include PW into codeigniter controller the page render output the markup but the paths are screwed. You need to either install PW in the root same as application and system (in case of codeigniter) but that may create problems, or leave it in a subdirectory and somehow fix the paths with htaccess vodoo. I don't really know the answer and what would be best in this case.
@somartist | modules created | support me, flattr my work flattr.com
#12
Posted 03 May 2012 - 03:59 AM
Thank you very much for yours answers. I´ve found that to display the fields I have to include them in the template file. I have given the format I wanted and put the fields in this file, but i have a new question: if I do all this in the template file, what use is to resize the fields and their order in the template?
Thanks!!
Thanks!!
#13
Posted 03 May 2012 - 10:55 AM
if I do all this in the template file, what use is to resize the fields and their order in the template?
This is purely for controlling the presentation in the admin side. It really doesn't mean much on the front-end of your site, unless you iterate the $page object (in which case the fields will follow the same order).
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













