Jump to content

Recommended Posts

Posted

Hi!

I´m a new user of processwire and i have the next problem.

When i include the sequence in my program i get an error:

Error Call to undefined method Template::getTableData()

I need help please

Thanks!

Posted

Hi Mike,

Welcome to the forums.

What are you trying to include and in what script are you trying to include it? Can you give a code example?

/Jasper

  • Like 1
Posted

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!

Posted
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().

Posted

Thanks Ryan, but my most inmediate problem is another.

I created a template and I created a page with this, but this does not show the fields.

Why can this be?

Thanks!

Posted

Mike can you give us a lot more detail? Are you creating a page in the admin or in the API? If in the API, is this from a template, a module or from a command line script? If you think screenshots would be helpful, please include that too.

Posted

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!

Posted

You can access any of the $pages fields like: $mypage->title. If you want to render the entire page and echo it to the user, you can do this:

echo $mypage->render();
Posted

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:

wire('pages')->setOutputFormatting(true);

Now it show the fields but without the template format and images.

Why can this be?

Posted
Now it show the fields but without the template format and images.

Why can this be?

I'm not sure I understand. Can you post a screenshot of the output that you get?

Posted

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.

Posted

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!!

Posted
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).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...