Jump to content

Use HannaCode to fetch an include file


Peter Knight
 Share

Recommended Posts

I'm moving a client site to PW.

They've been using Dreamweaver for years and want to continue to use Dreamweaver for some elements of their site.

One of these elements is a pretty complex order form (webform.php)

I was considering the following

  • A normal PW page called order would have a body field.
  • Within this, I'd call a HannaCode called [[get-webform]]
  • within the code of the hanna code, I'd call that webform.php as an include

That'd mean the client can FTP up any changes to include/webform.php and therefore bypass PW a little for this particular element.

I know an alternative would be to include the webform.php directly in the template but was wondering if above approach might work too?

I've actually tried it already and am getting no output from the HC.

Warning: include(/includes/webform.php): failed to open stream: 

No such file or directory in /var/www/vhosts/site.com/httpdocs/site/assets/cache/HannaCode/webform.php on line 3 Warning: include(): 

Failed opening '/includes/webform' for inclusion (include_path='.:') in /var/www/vhosts/site.com/httpdocs/site/assets/cache/HannaCode/webform.php on line 3

webform.php does exist on the server and my other includes work just fine. Some of those other includes contain PHP selectors etc.

Link to comment
Share on other sites

Looks like a path issue - includes need the full server path, but you have:

Warning: include(/includes/webform.php): failed to open stream: 

You might be able to get away with ./includes/webform.php if includes is a subfolder of site/templates.

Link to comment
Share on other sites

Maybe have a look at the chmod of the php files. This could be an issue as you say other files work.

Permissions all check out.

I manually copied my php file from /includes/ to /assets/cache/HannaCode/ and the php include works great.

For some reason my other includes are auto-copied to this location (and work) but the new include wasn't.

Link to comment
Share on other sites

I manually copied my php file from /includes/ to /assets/cache/HannaCode/ and the php include works great.

I realised that although this successfully displayed my form, it wouldn't help my client. Anything they edit and FTP into /templates/includes/ still wouldn't be reflected in /site/cache/HannaCode

The suggestion by @Macrura (and probably @LostKobrakai) worked out in the end.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

I'm also not able to use include or wireRenderFile in my Hanna Code.
I always get Error 500

I can call my portfolio.php in my home.php template file like this: 
$temp = wireRenderFile("./portfolio"); // In this case we need a return $content in portfolio.php
$content .= $temp;
or this:
include("./portfolio.php");

but this won't work in Hanna Code.

If I paste the whole portfolio.php code into the hanna code it works too, but I would rather not to manually copy the stuff into Hanna Code everytime I edit the File.

I'm on PW V.3.0.35

If anybody has an idea...

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

×
×
  • Create New...