Jump to content

[SOLVED] can't install custom Hook


picarica
 Share

Recommended Posts

so i am trying to put CustomHooksForVariations.module, a custom module, i am placing it into site/modules direcotry yet my modules page in admin panel gives me errors

so this is the screen show when i refresh modules, i dont know why the shole hook is written on top of the page :||

replace.thumb.png.76f88152c77ac74af1a557f8b41c70de.png

and this next image is when i try to install it, i saw that it is not defiuned modules.php but it shouldnt need to be ?, any ways i dont want to edit site's core just to make one moulde work there has to be a way

1067420863_Screenshot_2020-09-26Screenshot.thumb.png.a52288961b342558cecc52db66512181.png

Link to comment
Share on other sites

Just checking, but you didn't forget to add <?php at the top of your module file, did you? ?

Note: I've moved this topic to the "Module/Plugin Development" forum area. The "Modules/Plugins" area is only intended for support threads of finished modules.

  • Like 1
Link to comment
Share on other sites

51 minutes ago, teppo said:

Just checking, but you didn't forget to add <?php at the top of your module file, did you? ?

Note: I've moved this topic to the "Module/Plugin Development" forum area. The "Modules/Plugins" area is only intended for support threads of finished modules.

okay i checked and no i didnt had ?php tags, i didnt even know i needed them, nowhere in guide i found any indiciations

Link to comment
Share on other sites

Glad you got it sorted!

ProcessWire modules are written in PHP, and PHP code always requires the "<?php" start tag -- otherwise it's interpreted as plain text.

In case you're embedding PHP within HTML you'll also need the closing tag "?>" (<h1><?php echo $page->title ?></h1>), but if the entire file is in PHP (as module files usually are) it's best to leave that one out.

  • 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

×
×
  • Create New...