Using PHP in Joomla Template - php

I'm developing a site using joomla template. I want to create a registration form & I design it with html in a Joomla Article. For data passing to db I have created a PHP file. But I have a problem in submitting data. I gave form action="php file name" & I save the PHP file in index path. But system is not working. Please tell me where I need to save that PHP file & how to link my joomla article & PHP file ???

Create a custom file upload component and upload your php files. Create a menu item for your component and assign a PHP file to menu you want to show your registration form on and finally at front-end include PHP file in your view.

Create a folder inside plugins in main directory.
Name it whatever you like, lets say, "customplugin". Put your form handling file in that.
Give the absolute path of this file in the form action URL.
This should work. Also, kindly check if the form tags are coming correctly in the article.
As others are saying, you are actually not using the Joomla CMS properly, but anything and everything is possible...
Mistakes are always forgivable, if one has the courage to admit them.
-- Bruce Lee

Related

How to use php pages in Joomla?

I have 2 php pages, form.php and results.php. The form accepts user data and send to the database with mysql query, the results page retrieves the data for display.
I have installed Joomla as my CMS and it is connected with the database in which the form data is also stored.
How can i use these two pages in joomla?
You are better off developing a component for Joomla as that is the correct way to extend the functionality. Take a look at http://www.component-creator.com it can write all the code for you.
You can place these two pages into your web root directory & those will work.
If you want to use configurations defined for Joomla, just include those files into your PHP files.
If you want to place your form within a Joomla article, I would suggest using a form builder extension - there are quite a few in the Joomla extensions directory: http://extensions.joomla.org/extensions/contacts-and-feedback/forms
Using an extension like this will allow you to create your form in the Joomla admin area, publish it to your site, and then accept submissions which could then be emailed to you or viewed in the admin area.

Upload file page in Wordpress and reponse there

I'm a beginner in PHP but an expert in programming in general, so I program C and C++ usually, but I have no experience with posting and getting with PHP, so I don't really understand the exact mechanism how this works.
Yesterday I worked for like two hours on my webserver and set a page on my Wordpress to make visitors upload a file. The page submits a form to a custom PHP page, but that page is empty and dull, and I would like to make the confirmation page in Wordpress itself. What I tried to do for that is that I created a new page, and used the plugin "insert PHP", and simply pasted the code from the page, to which the form submits, and made my upload form post to that Wordpress page. This doesn't seem to work.
How can I get this to work?
Simplifying the question: How can I make my form in wordpress post to another wordpress page and give the response in a wordpress page rather than a PHP page created from scratch?
If my question is not clear or requires any additional information to be answered, please let me know.
Thank you.
You're going to want to get to know specialized page templates in WordPress, and the page templating system in general. Ideally, you'd create a page in wp-admin and create a specialized page template for it.
If you're doing form processing, you can do that in the new template...but may be better off moving that logic to the functions.php file. Use action hooks to ensure that your processing functions are run on submit.

Add file attachment to default Joomla 2.5 contact form

I have a website that is using the default Contact form along with other data from the Contacts component and I need to add a file upload function to it.
I know there are many form components out there, I have used many of them but this site is using the default contact form from the Contacts component and also some other contact data here and there. So I don't want to have to build a whole new Contact page and form just to add file uploading. The file I want to update is templates/TEMPLATENAME/html/com_contact/contact/default_form.php
I am not a programmer unfortunately and even though I found a possible solution here: http://www.rupostel.com/joomla/hacks/how-to-add-uploads-to-your-joomla-contact-form, I was not able to follow it completely. I downloaded and activated the plug-in but nothing showed up.
Can anyone assist?
Thanks in advance.
Paul

Jquery File Upload plugin: Dynamically change upload path?

I'm trying to use the blueimp Jquery File Upload plugin for the project I'm currently working on. It suits my needs perfectly, with one problem: I need to be able to change the path of the uploads, based on a GET variable on the page that contains the plugin. Basically, I'm using it as an image manager for a collection of vehicles, and I want it to connect to a separate folder for each vehicle.
I've been looking through the documentation and googling, and I've found the way to change the default directory (by modifying upload.class.php) but since I need this to be dynamic, that doesn't work.
I figure there has to be a way to add a POST variable to the ajax calls which activate the php scripts, but I can't even find out where those ajax calls are. I can't even find a reference to either of the php files (index.php and upload.class.php) throughout the code.
Any ideas on how to accomplish this?
In your form, add a field like this:
<input type="hidden" name="path" value="<?echo $_GET['path'];?>">
And in your PHP where the file is uploading, just extract the path with:
$path = $_POST['path'];
Just put the path where it is specified in the PHP script.

How can I integrate PHP code into a WordPress page?

I have a simple HTML form that posts to a PHP page, which will then return the user some content.
I want to take this PHP code and get my WordPress theme to wrap around it, so that appears like a normal page on my site. I can't find any resources on this - where do I begin?
You can create a new page template by uploading a PHP file which starts with the following:
<?php
/*
Template Name: Something
*/
?>
Then create a new page in WordPress, and look in the dropdown box for Template on the right (depending on what version you are using). Select that, and that newly created page can now have whatever PHP code in it you want. You'll probably want to copy the default page template (if one exists) as a starting point.
Find out the post ID / page ID of where you want your custom PHP code to go.
Assuming that where your custom code will go is in a post, you should create a file in your theme's folder called single-POSTID.php.
Assuming that where your custom code will go is in a page, you should create a file in your theme's folder called page-PAGEID.php.
Copy the base code from single.php or page.php into the newly created file, and you can insert your custom code in the new files. Form actions should usually be "#" and if your form isn't working appropriately, it's most likely because of one of your HTML form fields are used by WordPress to do something. (e.g. a textbox with the name of "comment" will not properly work under your code, since WordPress will think you're trying to add a comment).
If you do anything that requires database access, WordPress keeps the DB connection alive in your theme, so you don't need to connect to the database again. Unless of course, whatever you're trying to do is in a separate database other than the one WordPress is installed in.

Categories