How to include PHP and javascript code in articles ?

This forum is for general questions about extensions for Joomla! version 1.5.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
arvin88
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sun Mar 09, 2008 3:46 pm

How to include PHP and javascript code in articles ?

Post by arvin88 » Sat Mar 15, 2008 9:12 am

Hey there !

Can some one answer these questions ?

1) How to include PHP and JAVASCRIPT code in articles , so i can embed registration form in articles. I am creating a college cultural website and i need to embed registration form for each event .

2) How to add a navigation bar inside a article ? This is how i want the look to be . I am attaching the images

Link to site : http://kurukshetra.org.in/events/index.php

Image

Image

Please help me, i need your help !!! Very Urgent !

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Sun Mar 16, 2008 6:13 pm

How to include PHP and javascript code in articles ?
You need a content plugin for this.
Try Jumi extension http://extensions.joomla.org/component/ ... Itemid,35/
or find another "from tools" plugin that suit best to your needs: http://extensions.joomla.org/component/ ... Itemid,35/
MarHaj

allan27
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Feb 22, 2008 2:54 am

Re: How to include PHP and javascript code in articles ?

Post by allan27 » Fri Mar 21, 2008 3:10 am

Hi Martin,

I've been using Joomla for the past 2 weeks, I'm not totally familiar with it, and I'm facing the same problem like the thread starter. :( So lucky there's Jumi.

Im very new to the Jumi,

I have problem to understand how it works...

i have read through the tutorial site, the demo shows that

{jumi [somepath/hello_args.php] [Hello World!]}

Let's say i put my php file at c:\wamp\www\Prototype\jumies\hello_args.php

so... how am i going to replace my path at the [somepath/hello_args.php]?

i have tried, [..Prototype/jumies/hellow_args.php] but it's not working.

Would you enlighten me pls?

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Fri Mar 21, 2008 10:41 am

The path to the file you shoul write down is a relative path to the file with respect to the Joomla root in current Jumi releases.
Examples
a) If your Joomla root (i.e. where configuration.php and index.php is) is c:/wamp/www/Prototype
and your hello_args.php is at c:\wamp\www\Prototype\jumies\hello_args.php
then
{jumi [jumies/hello_args.php]}
will work.
b) If your Joomla root (i.e. where configuration.php and index.php is) is c:/wamp/www
and your hello_args.php is at c:\wamp\www\Prototype\jumies\hello_args.php
then
{jumi [Prototype/jumies/hello_args.php]}
will work.
MarHaj

allan27
Joomla! Apprentice
Joomla! Apprentice
Posts: 19
Joined: Fri Feb 22, 2008 2:54 am

Re: How to include PHP and javascript code in articles ?

Post by allan27 » Mon Apr 07, 2008 10:01 am

Thank you!!!!! Quite busy recently, that's why only now I post this thank you, hope you don't mind

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Mon Apr 07, 2008 12:36 pm

No need to apologize yourself. I really appreciate your acknowledgments whenever they come. :)
MarHaj

davidllovi
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Sun Nov 02, 2008 10:28 am

Re: How to include PHP and javascript code in articles ?

Post by davidllovi » Sun Nov 02, 2008 10:36 am

Hi,
thanks for all the help provided. I would like to check if I am following the proper way with including a .js file.
I have a library file in javascript I would like to use. I have done the following:
- installed jumi
- I have uploaded my file using docman. I could also use the image uploader. Is that a good policy?
- enabled the JCE to include javascript
- and then included:
<script type="text/javascript">{jumi [dmdocuments/funcs.js]}</script>

And it works!
Is there anything I could improve?
Thanks!!

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Sun Nov 02, 2008 10:56 am

I have uploaded my file using docman. I could also use the image uploader. Is that a good policy?
I am usually using FTP client. Like Filezilla. But any method of uploading a file into the server is fine (if it works). Rem: for security purpose (not allowing people to view and stole your files) put into each directory empty index.html file.
Is there anything I could improve?
With respect to this problem hardly. And with respect to other sites of your life? Who knows?;)
MarHaj

davidllovi
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Sun Nov 02, 2008 10:28 am

Re: How to include PHP and javascript code in articles ?

Post by davidllovi » Sun Nov 02, 2008 12:30 pm

Haha!
My psicotherapist says I shouldn't worry so much about improving. That worries me. ;)
Thanks

lguilherme
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Thu Feb 14, 2008 6:45 pm

Re: How to include PHP and javascript code in articles ?

Post by lguilherme » Wed May 06, 2009 4:16 am

Hi MarHaj !
Well, I wasn´t so lucky (or wise!) with Jumi...
From the documentation I figured this is a piece of well structured quality Joomla software.
But I tried all three ways to use it (via a module, via a content item with the plugin syntax and from a js file stored in the default joomla root directory) an the result was always the same: whenever the item was published it blocked my whole front-page (where I need to put it).
My application is very simple, similar to a Google AdSense, but from a local Brazilian ad company named boobox (boobox.com).
Can you help me get this solved ? I simply don´t know where to look and I have to get this job done by tomorrow.
Tks a lot !

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Wed May 06, 2009 7:09 am

whenever the item was published it blocked my whole front-page (where I need to put it).
Lguilherme,
I wish I could help.
You have a rather strict need: by tomorrow.
I am afraid I am busy right now and will be available just few hours these two days.
Nevertheless we could try it.

Could you be more specific with "blocking". Or better: send me an email (admin at vedeme.cz) with your code attached. I will have a look at it and let you know (rem - I am leaving now and will be back in 12 hours).
MarHaj

nayyerkamran
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Jul 08, 2009 4:02 pm

Re: How to include PHP and javascript code in articles ?

Post by nayyerkamran » Wed Jul 08, 2009 4:15 pm

Hello Martin,

I tried to use jumi plugin and used following code in my article.

{jumi [form_handler/form_handler.php]

and when I browse to article it simple print out the same line. As far pathing is concern I can access this form_handler.php page using following URL

http://localhost/site_name/form_handler ... andler.php

Can you give me some suggestion what I may be missing or doing wrong.

Thanks,

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Thu Jul 09, 2009 7:30 am

{jumi [form_handler/form_handler.php] and when I browse to article it simple print out the same line.
Hi,
there can be several reasons there.
a) Jumi 2.0 plugin syntax differs from that of 2.1
for 2.0: {jumi [form_handler/form_handler.php]}
for 2.1: {jumi form_handler/form_handler.php}{/jumi}
c) Verify the between left curly brace and word jumi is no space
d) Verify that plugin is published in the admin backend
e) Several templates are known to have problems with curly bracket plugins. Try, just for verification if something changes, Joomla default.
MarHaj

nayyerkamran
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Jul 08, 2009 4:02 pm

Re: How to include PHP and javascript code in articles ?

Post by nayyerkamran » Thu Jul 09, 2009 11:26 am

Hello Martin,

Thanks for your answer. The problem was not with template; it was because of an invisible character between "{jumi" and the next brace "[". It was becasue I cut paseted the syntax. :(

Thanks for your help.

dynamyt100
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Nov 11, 2009 11:56 am

Re: How to include PHP and javascript code in articles ?

Post by dynamyt100 » Fri Nov 13, 2009 5:12 am

Hi. I read these posts and decided to install Jumi for v1.5

I have a file /www/africawebforce.com/plugins/Simple RSS Feeder/mod_jw_srfr.php
In my article I have syntax : {jumi [plugins/Simple RSS Feeder/mod_jw_srfr.php]}

I get the following error code :

Africa Web Force

Warning: require_once(/home/davhart/public_html/africawebforce.com/modules/mod_jw_srfr/mod_jw_srfr/simplepie.inc) [function.require-once]: failed to open stream: No such file or directory in /home/davhart/public_html/africawebforce.com/plugins/Simple RSS Feeder/mod_jw_srfr.php on line 59

Fatal error: require_once() [function.require]: Failed opening required '/home/davhart/public_html/africawebforce.com/modules/mod_jw_srfr/mod_jw_srfr/simplepie.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/davhart/public_html/africawebforce.com/plugins/Simple RSS Feeder/mod_jw_srfr.php on line 59

Please can you help me on this :-)

Dave

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Fri Nov 13, 2009 1:20 pm

Hi Dave,
it seems to me that the script mod_jw_srfr.php is trying to include another file, namely /home/davhart/public_html/africawebforce.com/modules/mod_jw_srfr/mod_jw_srfr/simplepie.inc on line 59. But it fails.
Either verify the file simplepie.inc exists there or change (on the line) path to it.
And verify that has "read" permission too.
MarHaj

dynamyt100
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Nov 11, 2009 11:56 am

Re: How to include PHP and javascript code in articles ?

Post by dynamyt100 » Fri Nov 13, 2009 1:33 pm

HI Martin. Thanks for the info and help :-) I just found it strange that the plugin is referring to a file that doesn't exist. I will attempt a fix :-)

Dave

User avatar
MarHaj
Joomla! Ace
Joomla! Ace
Posts: 1168
Joined: Fri Jun 30, 2006 5:24 pm
Location: CZ
Contact:

Re: How to include PHP and javascript code in articles ?

Post by MarHaj » Fri Nov 13, 2009 7:58 pm

I just found it strange that the plugin
When including 3rd party files by Jumi it is "normal" behavior.

It is because when a file is included by Jumi she "forgets" its real location. She things she belongs to a Joomla! page from the beginning of the world and she believes her motherland is Joomla! root.

So you have to often rewrite files - those lines in them that are referencing other files. It is probably your case.
MarHaj

dynamyt100
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Nov 11, 2009 11:56 am

Re: How to include PHP and javascript code in articles ?

Post by dynamyt100 » Sat Nov 14, 2009 5:38 am

Thanks Martin. I appreciate your input here. Very nice to have an 'oracle' to consult :-)

param107
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Dec 04, 2009 11:52 am

Re: How to include PHP and javascript code in articles ?

Post by param107 » Wed Dec 16, 2009 7:29 am

MarHaj wrote:
How to include PHP and javascript code in articles ?
You need a content plugin for this.
Try Jumi extension http://extensions.joomla.org/component/ ... Itemid,35/
or find another "from tools" plugin that suit best to your needs: http://extensions.joomla.org/component/ ... Itemid,35/

But how does it works.I have installed it.it's coming in the list of modules in module manager.what next i have my php form ready.

rabiya
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Jul 07, 2009 7:38 am

Re: How to include PHP and javascript code in articles ?

Post by rabiya » Tue Dec 22, 2009 7:44 am

Hi Friends,

I have installed jumi component.When i click on Jumi coponent(Jumi Applications Manager ), there is two articles.Also, Jumi module installed. I want to display contents using jumi module.So, I enabled Jumi module and in module parameters, added Source of code as {jumi [hello_args.php]}, hello_args.php is in the joomla root directory.And in Advanced Parameters, Default Absolute Jumi Path as /home/servername/htdocs/newjoomla.
But it displays the error,
File /home/servername/htdocs/newjoomla/{jumi [hello_args.php]} does not exist or is not readable!

Can anyone help me?

Thanks,
Rabiya

User avatar
revive1
Joomla! Intern
Joomla! Intern
Posts: 87
Joined: Sat Apr 12, 2008 1:41 am

Re: How to include PHP and javascript code in articles ?

Post by revive1 » Wed Dec 23, 2009 2:08 am

If this portion of the code is viewable in your page error: {jumi [hello_args.php]}

Than you probably have a plugin that is not enabled. Check to make sure you Jumi plugin is enabled and configured correctly.. that should fix it.
My favorite web design/dev tools:
Rackspace Cloud Files + Cloud9 http://cloud9manager.com
24" iMac, MAMP Pro, Logitech MX Revolution, Coda, TextMate, Transmit, Snippley and Adobe CS4
For small ecommerce: http://nanao-cart.com

rabiya
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Jul 07, 2009 7:38 am

Re: How to include PHP and javascript code in articles ?

Post by rabiya » Mon Dec 28, 2009 9:48 am

Hi Friends,

Jumi plugin was already enabled...

I have attached the screenshot here..
jumi1.JPG
Thanks,
Rabiya.
You do not have the required permissions to view the files attached to this post.

santoshkon
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Tue Nov 17, 2009 8:44 pm

Re: How to include PHP and javascript code in articles ?

Post by santoshkon » Thu Jan 07, 2010 7:32 pm

Can I write databse code in a php file and then include it in a article and can make database processing possible. Please reply

tobypsl
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Tue Nov 14, 2006 10:21 pm

Re: How to include PHP and javascript code in articles ?

Post by tobypsl » Sun May 16, 2010 10:46 am

Hi

It looks like I may be able to use Jumi to include a sortable table javascript, which I found here:

http://www.webtoolkit.info/sortable-html-table.html

But I'm not sure how to use the component. Before I spend several hours figuring what to do, can someone kindly advise on whether my ambitions are possible ?

cheers,
Toby

tobypsl
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Tue Nov 14, 2006 10:21 pm

Re: How to include PHP and javascript code in articles ?

Post by tobypsl » Wed May 19, 2010 2:46 pm

In case anyone else wants similar functionality - it turned out to be quite straight forward with Jumi. Include the js file in the main web root directory, or any other directory you want to reference, then put the table code inside the Jumi component. Call the content using, for example, {jumi 4} and the code stored in the DB 4 is rendered with the js file included for that page. Excellent. :laugh:

sleenee
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sat Nov 06, 2010 9:51 am

Re: How to include PHP and javascript code in articles ?

Post by sleenee » Sat Nov 06, 2010 1:48 pm

I can't seem to get this to work.

I have jumi joomla v1.5 installed with jumi 2.0

I have the following code in my jumi file (and I tried various changes)

<html>
<body>

<?php

{jumi[*1]}

?>

</body>
</html>

I also tried files outside of a joomla table like the jumi-demo php-file

<html>
<body>

<?php

{jumi [plugins/content/jumi/jumi_demo.php]}

?>

</body>
</html>


I tried it with and without the html and body tags. I tried it with those tags inside or outside (like in the examples here) the included code. What am I doing fundamentally wrong here? I have no clue anymore. These are not even my codes I try to include, it's standard examples from jumi itself.

help would be greatly appreciated

Roops
Joomla! Apprentice
Joomla! Apprentice
Posts: 20
Joined: Tue Jan 11, 2011 3:20 pm

Re: How to include PHP and javascript code in articles ?

Post by Roops » Thu Jan 20, 2011 5:00 pm

Hi everybody,

I m stuck'd with editing PHP code in article.
I have web page called enrollment in my website, where i fill the form and submit.
as soon as i submit, the data should be in my database. i use WAMP as my server.

when i click on submit button.
I get the following error message:

"404 Forbidden

You don't have permission to access /joomla/< on this server."

Can you please help me at this point. its urgent!!!!

Cheers
Roops

tobypsl
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Tue Nov 14, 2006 10:21 pm

Re: How to include PHP and javascript code in articles ?

Post by tobypsl » Thu Jan 20, 2011 5:18 pm

sleenee wrote:I can't seem to get this to work.

<html>
<body>

<?php

{jumi[*1]}

?>

</body>
</html>

I tried it with and without the html and body tags. I tried it with those tags inside or outside (like in the examples here) the included code. What am I doing fundamentally wrong here? I have no clue anymore. These are not even my codes I try to include, it's standard examples from jumi itself.

help would be greatly appreciated
Try it without the php tags too. The idea is that {jumi [*1]} calls the code from your jumi component. I didn't use php tags when I wanted to include code just used the plugin and referenced the pre-stored entry I wanted to include. Although I'm no expert so I may have misunderstood what your problem is.

tobypsl
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Tue Nov 14, 2006 10:21 pm

Re: How to include PHP and javascript code in articles ?

Post by tobypsl » Thu Jan 20, 2011 5:38 pm

Roops wrote:Hi everybody,

I m stuck'd with editing PHP code in article.
Being stuck'd is no fun. Presumably when you say editing php in your article you mean including it via Jumi ? Obviously the idea of Joomla is that you don't personally have to play around with php and the idea of Jumi that when you want to you can.

You might find it easier to use Sourcerer (google for Joomla sourcerer). There is an accompanying plugin that will add an 'Add Code' button to your editor, which opens a sourcerer editor so you can just paste your code. Best to use the button and their editor otherwise your own editor might stick undesirable html tags into the code.

Good luck.


Locked

Return to “Extensions for Joomla! 1.5”