Jump to content

Including PW in TYPO3 page


doolak
 Share

Recommended Posts

Hi there,

does anybody have experience with including PW data in a TYPO3 website?

I have already included PW in other systems, but so far could not get it work in TYPO3.

I included this PHP script:

<?php  
include("/srv/www/xyz/htdocs/pw/index.php");
$termin_page = wire("pages")->get("/xyz/termine/");
	$termine = $termin_page->children;
	echo "<div id='pw_termine'>";
	
	foreach($termine as $termin) {
		echo "<div class='termin'>\n";
		if ($termin->termin_image) {
		echo "<img src='{$termin->termin_image->url}' title='' />\n";
		}
		else echo "<img src='/fileadmin/xyz/include/termine/termin_blank.png' />\n";
		echo "<h2>{$termin->title}</h2>\n";
		$date = date("d.m.Y", $termin->getUnformatted("termin_datum"));
		echo "<span class='datum'>$date</span>\n";
		echo $termin->termin_kurzinfo;
		
		echo "</div>\n";
		
	      }
	      
    echo "</div>";

?>

In this way I get an Internal Server Error.

Then I tried to include PW as a seperate script and then include the script above without the PW include - but in that way I get the follpwing error: Fatal error: Call to undefined function wire() in ...

So PW was not included.

Anybody who successfully included PW into TYPO3 out here?

Link to comment
Share on other sites

In debug mode I received an error message:

Error: Call to undefined method template::getTableData() (line 115 of /srv/www/xyz/htdocs/pw/wire/core/WireSaveableItems.php) 

As I thought the problem could be related to the wrong PHP version (the webserver runs still on PHP 5.3.3) I tried an older PW version (2.3.1) which should work on that PHP version, but I still receive a similar message:

Fatal error: Call to undefined method template::getTableData() in /srv/www/xyz/htdocs/pw/wire/core/SaveableItems.php on line 108

So the PHP version does not seem to be the problem - does anyone has an idea what could be the problem?

Link to comment
Share on other sites

hi,

what are you trying to archive, do you have the site 'around' your processwire contents in TYPO3, ie do you need to 'inject' the pw contents in the templates of the TYPO3 page?

if you need to inject your own data into TYPO3 rendering, you need to create a PHP_SCRIPT content element, give your php file as the lib and return all of your data in a $content variable, this will then be rendered by TYPO3. (http://docs.typo3.org/typo3cms/TyposcriptReference/AppendixA/Index.html)

It's been a while since I last fiddled with TYPO3 and external scripts, and I always went with the Typoscript way of handling it, so maybe there's now an easier way with the fluid templating stuff and the newer TYPO3 versions...

cheers

Tom

Link to comment
Share on other sites

  • 3 weeks later...

hi,

what are you trying to archive, do you have the site 'around' your processwire contents in TYPO3, ie do you need to 'inject' the pw contents in the templates of the TYPO3 page?

if you need to inject your own data into TYPO3 rendering, you need to create a PHP_SCRIPT content element, give your php file as the lib and return all of your data in a $content variable, this will then be rendered by TYPO3. (http://docs.typo3.org/typo3cms/TyposcriptReference/AppendixA/Index.html)

It's been a while since I last fiddled with TYPO3 and external scripts, and I always went with the Typoscript way of handling it, so maybe there's now an easier way with the fluid templating stuff and the newer TYPO3 versions...

cheers

Tom

Yes, I wanted to do it exactly like you described - tried to include / inject PW in an excisting TYPO3 website.

There is an easier way, already included several PHP scripts with tt_content.script:

tt_content.script = CASE 
tt_content.script {
  key.field = select_key
  FORMULAR = PHP_SCRIPT_EXT 
  FORMULAR.file = fileadmin/xyz/include/landingpage/index.php
}

But with PW I receive the error in PW...

I never worked with Typo3, but is it possible that both have class Template, and when you call Template::SomeMethod(), Typo3's class is picked up?

Yes, there seem to be a template class in TYPO3: https://docs.typo3.org/typo3cms/InsideTypo3Reference/CoreArchitecture/Backend/TheTemplateClass(templatephp)/Index.html

If this is the problem - any idea for a workaround?

Link to comment
Share on other sites

Well, it's a web service. You can use JSON. Or some server driven mechanism, like curl and some php. It's the only external interface to ProcessWire as far as I know. Since you can't simply include ProcessWire in Typo3, I think it's the route to take...

  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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