Jump to content

include a php file


Recommended Posts

I have uploaded a php tell a friend script.

But how do i include the file to fx my header?

Back in the days I just written

<?php include("tell_a_friend.php"); ?>



But it doesnt add anything. I have put the file in the root of the webshop.

Is there a different way to include a php file?

Link to comment
Share on other sites

The problem is that you need all that code just to do something simple :D

It isn't actually as hard as it looks. The only things you really need to change are:

1) Name of the module (and maybe the description etc. but that's cosmetic)
2) Decide which parts of the theme you need to insert code into (e.g. html header, left column)
3) Install the hook functions in the install() member function for the areas identified in (2) (i.e. `handlers` to insert js/css in header & markup in leftcolumn)
4) Populate the hook functions with the code you need to produce your markup.

Note that you can directly `echo` from them (as is done in the example), or you can assign variables to and pass output through, the smarty template engine (added unnecessary complication if you don't need/want the mark-up to be end-user `tweakable`).

It isn't hard really, but without having all that framework overhead in place a module won't work and you'll have to resort to editing the core files directly to add your code. You can do that of course, but I suspect you will regret it when you try and upgrade ;)

Paul

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
×
×
  • Create New...