How to put an existing php function into module
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
How to put an existing php function into module
I have been using an application for users to play music on my website. This was (and still is) on the ASP driven website
This app is also available as a php script and the total package consists of the scriptfile, a preferencesfile, read in by the script and the mp3 files played by the script.
Long time ago, at least in the early days of J! 1.5 , I read a post explaining how to put your own app into a Joomla 1.5 module. Nothing to fancy, just make it into a module so I can run it from a menu or module position.
I made some changes to the scriptfile and setup an xml file so I could do the install.
Next step would be how to get the output of the script into the webpage and there I am stuck. Thats why I was thinking about this old post which I cannot find anymore.
It is too small a app to go MVC etc.
This app is also available as a php script and the total package consists of the scriptfile, a preferencesfile, read in by the script and the mp3 files played by the script.
Long time ago, at least in the early days of J! 1.5 , I read a post explaining how to put your own app into a Joomla 1.5 module. Nothing to fancy, just make it into a module so I can run it from a menu or module position.
I made some changes to the scriptfile and setup an xml file so I could do the install.
Next step would be how to get the output of the script into the webpage and there I am stuck. Thats why I was thinking about this old post which I cannot find anymore.
It is too small a app to go MVC etc.
pieter
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: How to put an existing php function into module
Pieter -
Would the v 1.5 Module Tutorial be of assistance? Might be a good app to try your hand at an extension.
Good luck!
Amy
Would the v 1.5 Module Tutorial be of assistance? Might be a good app to try your hand at an extension.
Good luck!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
Re: How to put an existing php function into module
Thanks Amy, that is what I was looking for and could not find back.
You are a star
Rgrds,
Pieter
You are a star
Rgrds,
Pieter
pieter
Re: How to put an existing php function into a module
I had a look at this tutorial and found that it is rather tricky for me to use that example for the script I have.
In my script is no db access but flat files (no helper needed I think) and the output is echo'ed all over the place.
So, I do not know where to start.
I cannot publish the scriptfile in the forum because it has been payed for.
In my script is no db access but flat files (no helper needed I think) and the output is echo'ed all over the place.
So, I do not know where to start.
I cannot publish the scriptfile in the forum because it has been payed for.
Last edited by pvh123 on Fri Aug 24, 2007 9:16 am, edited 1 time in total.
pieter
- AmyStephen
- Joomla! Guru
- Posts: 579
- Joined: Wed Nov 22, 2006 3:35 pm
- Location: Nebraska
- Contact:
Re: How to put an existing php function into module
Pieter -
You might consider joining a growing group of us in the Joomla! 101 Coding forum. The Joomla! Coding Q/A thread is a good place to ask this question. In fact, I'll ask that this thread be moved into that forum - I hope that's okay with you!
It's a cool group. Lots of new curriculum being developed. Instructions for downloading and configuring an IDE that hooks into JoomlaCode's SVN environment, and perhaps most importantly, lots of very smart people who can answer these questions for you and ME as we learn how to do this.
I think you'd enjoy it; these are geeks and Joomla! fans, just like us!
Amy
You might consider joining a growing group of us in the Joomla! 101 Coding forum. The Joomla! Coding Q/A thread is a good place to ask this question. In fact, I'll ask that this thread be moved into that forum - I hope that's okay with you!
It's a cool group. Lots of new curriculum being developed. Instructions for downloading and configuring an IDE that hooks into JoomlaCode's SVN environment, and perhaps most importantly, lots of very smart people who can answer these questions for you and ME as we learn how to do this.
I think you'd enjoy it; these are geeks and Joomla! fans, just like us!
Amy
~*~ Joomla!'s Queen of the Blues - Jennifer Marriott ~*~
http://OpenSourceCommunity.org/node/1719/
http://OpenSourceCommunity.org/node/1719/
Re: How to put an existing php function into module
Moderator note: Topic moved from 1.5 General Questions to Joombie Coding Q/A.
Gergo Erdosi
Re: How to put an existing php function into module
Welcome to J!101 Pieter. I don't have the answer to your question but I'm sure you've come to the right place. Ready guys? GO!
Knowledge is realizing that the street is one-way, wisdom is looking both directions anyway.
Re: How to put an existing php function into module
Hi Pieter,
I'm not sure if this will help you out at all or not, but if I were doing what you're trying to do, I might be inclined to build a wrapper module that would take a parameter containing a path to the actual PHP file to include and possibly a method to execute. This appears to be especially true in your case since it sounds like the script you have doesn't really do any separation of code and presentation.
The actual module would be pretty small and not too complex to build. Basically you could take the hello world example that Amy posted and modify the helper to read the module parameters and 'include' or 'require' the PHP script identified by the parameter.
Does that make sense?
--joatmon
I'm not sure if this will help you out at all or not, but if I were doing what you're trying to do, I might be inclined to build a wrapper module that would take a parameter containing a path to the actual PHP file to include and possibly a method to execute. This appears to be especially true in your case since it sounds like the script you have doesn't really do any separation of code and presentation.
The actual module would be pretty small and not too complex to build. Basically you could take the hello world example that Amy posted and modify the helper to read the module parameters and 'include' or 'require' the PHP script identified by the parameter.
Does that make sense?
--joatmon
Re: How to put an existing php function into module
That's a great idea joatmon. Thanks for that. Is there already a module like that in 1.5? Anybody know?
Knowledge is realizing that the street is one-way, wisdom is looking both directions anyway.
Re: How to put an existing php function into module
AmyStephen wrote:
I think you'd enjoy it; these are geeks and Joomla! fans, just like us!
Amy
Ok, Amy Let me join the geeks at my age .
You are quite right. May be next time I can help someone else and learn while doing it.
pieter
Re: How to put an existing php function into module
-joatmon,
Ihave beenlooking at the Hello World example but was thinking a differenmt way.
The way you propose is simple and I will try that and see what happens.
Ihave beenlooking at the Hello World example but was thinking a differenmt way.
The way you propose is simple and I will try that and see what happens.
pieter
Re: How to put an existing php function into module
try this
http://extensions.joomla.org/component/ ... Itemid,35/
Enables insertion of any code into a custom module in Joomla! 1.5 - PHP, HTML, Javascript, CSS.
http://extensions.joomla.org/component/ ... Itemid,35/
Enables insertion of any code into a custom module in Joomla! 1.5 - PHP, HTML, Javascript, CSS.
This day it is my wish that I helped you to live
Re: How to put an existing php function into module
Thanks, tjay I have downed it and wil have a look at it. Let you know how it worked out.
pieter
Re: How to put an existing php function into module
Please do, I have been wondering if it would make a good skeleton type thing for more developed modules
This day it is my wish that I helped you to live
Re: How to put an existing php function into module
A little disappointing outcome of this particular function that I wanted to "Joomalise".
I have spoken with the owner, as you know it is a commercial product, and was told that the script cannot be hacked in order to embed joomla code. Because if it is edited, it is corrupt.
I still have one outstanding question with him and that is whether he is willing to put 2 lines of code in, the YOURBASEPATH thing, and than generate a new script for me. Just wait and see. The path code is needed because the script is heavenly driven by parameters from a textfile.
Just to let you know.
I have spoken with the owner, as you know it is a commercial product, and was told that the script cannot be hacked in order to embed joomla code. Because if it is edited, it is corrupt.
I still have one outstanding question with him and that is whether he is willing to put 2 lines of code in, the YOURBASEPATH thing, and than generate a new script for me. Just wait and see. The path code is needed because the script is heavenly driven by parameters from a textfile.
Just to let you know.
pieter
Re: How to put an existing php function into module
Hi Pieter,
I'm not sure if you ever got your question answered from the developer of your component, but if you're still interested, I have a module that allows you to include a php script. It's slightly different than the one you were earlier given because that one allowed you to paste code into a text box. This one allows you to put a path to the script you want run with an optional method to execute.
I would have posted it earlier, but I've been having Subversion issues and had to finally just set up my own svn server. Anyway, I digress...
I've attached the module for your pleasure.
--joatmon
I'm not sure if you ever got your question answered from the developer of your component, but if you're still interested, I have a module that allows you to include a php script. It's slightly different than the one you were earlier given because that one allowed you to paste code into a text box. This one allows you to put a path to the script you want run with an optional method to execute.
I would have posted it earlier, but I've been having Subversion issues and had to finally just set up my own svn server. Anyway, I digress...
I've attached the module for your pleasure.
--joatmon
- Attachments
-
- mod_tcwphp.zip
- (2.77 KiB) Downloaded 37 times
Re: How to put an existing php function into module
No, I never got a response from the owner. He did not want to make the changes I asked him to do. So, I have digressed from this product.
But, I am very glad to take up your offer and give it a try.
Thanks again, joatmon.
But, I am very glad to take up your offer and give it a try.
Thanks again, joatmon.
pieter
Re: How to put an existing php function into module
@joatmon I did install your module, but it gave a blank screen when loading the homepage.
pieter