This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
mySQL error embedding in joomla
Started 15 years ago by Markstein | 6 posts |
-
Hello,
I am trying to embed a form on my site using a joomla extension called directPHP. The extension allows posting PHP right into an article. So I use the Advanced Embed Code and paste it into the article.
The forms embed code is as follows:
<?php require("/usr/local/apache2/htdocs/forms/machform.php"); $mf_param['form_id'] = 2; $mf_param['base_path'] = 'http://mysite.com/forms/'; display_machform($mf_param); ?>
When I input this into my article I get the following error code and it totally throws off the whole template.
Error loading Modules:Table 'webforms.jos_modules' doesn't exist SQL=SELECT id, title, module, position, content, showtitle, control, params FROM jos_modules AS m LEFT JOIN jos_modules_menu AS mm ON mm.moduleid = m.id WHERE m.published = 1 AND m.access <= 2 AND m.client_id = 0 AND ( mm.menuid = 148 OR mm.menuid = 0 ) ORDER BY position, ordering
The above error appears 27 times down the page. Then at the bottom is my form working as it should.
The directPHP plugin itself is working with no problems.
Any ideas on what could be the problem and how I can fix this? I am assuming I need to change something within Machform.
Thank you,
Mark
Posted 15 years ago # -
Here is some more information on this. I had made a post awhile back on a different forum for a different plugin while trying to integrate machform into a joomla article.
This was a response I received from the developer.
Mark, thank you for a very interesting problem. The error message you have posted is a quite new in this thread. I am almost sure it comes from machform.php. Why i think so? The error message says that there are problems of loading modules that normally work. It indicates that something prevents them to work. What? There is nothing else then machform.php that could do that. How can do that? Simply. It suffices if there are some global variables (or function or objects) that have the same name with those defines by Joomla! It leads to a very unpredictable behavior of the whole. One piece od code rewrites the other. So the theory. How to prevent this? Generally it is obvious: a) if using global variables (defined outside objects or functions) I am giving them exotic names. b) I am avoiding as much as possible to use them. How? I wrap my code into the objects or functions. What to do in your case? I do not know how complicated machform.php is. If it is simple just rename suspicious variables there to another ones -exotic names which are not most probably used by Joomla. If the code is complicated and there are too many variables wrap it into the function or change it into an object. For example modify machform.php to: function mymachform ($par1, $par2) { here is the content of machform.php $mf_param['form_id'] = $par1; $mf_param['base_path'] = $par1; display_machform($mf_param); //to be displayed }
So I may need to rename some variables or something? I'm not entirely sure on what to do.
Thanks for any information.
Mark
Posted 15 years ago # -
Try to change your form code to be like this:
<?php require("/usr/local/apache2/htdocs/forms/machform.php"); $mf_param['form_id'] = 2; $mf_param['base_path'] = 'http://mysite.com/forms/'; display_machform($mf_param); mysql_select_db("your_joomla_db_name"); ?>
make sure to change "your_joomla_db_name" with your Joomla database name.
MachForm Founder
Posted 15 years ago # -
Hi Yuniar and thanks.
That seemed to have removed the error but the CSS of the site is really messed up on the page with the form.
I had a look in Firebug and duplicate CSS declarations are being made. For example, I now have 2 body tags. One from Machforms view.css and one from my templates layout.css. view.css is kicking in before my layout.css and so it is taking over the whole page.
view.css
body { font-family:Arial,Helvetica,sans-serif; font-size:11px; text-align:center; }
layout.css
body { color:#646464; font-family:Arial,Helvetica,sans-serif; font-size:12px; line-height:150%; }
So view.css takes over and all my text (on the page) is at 11px when it is supposed to be 12px and all the text on my page is centered. There are also problems with the footer being duplicated as well. Any ideas on what my options are at this point?
Thank you,
Mark
Posted 15 years ago # -
Hello Mark,
Which version of MachForm are you currently using?
The latest version shouldn't have "body" anymore.I think you can try removing the definition which is duplicated and then adjust it further for the others. It depends on your page css though.
MachForm Founder
Posted 15 years ago # -
I hadn't realized there was an update. I currently have 2.1b. I will install version 2.2 and report back if I have any issues!
Thanks Yuniar,
Mark
Posted 15 years ago #
Reply
You must log in to post.