Joomla routing engine -
i have written custom landing page want incorporate website. website using joomla cms. when type utl www.mysite.com/mylandingpahe.php 404 becuse joomla ruting engine kiks in , searches article in db..
this skeleton of landing page (basic contac form):
<?php $to = "somebody@example.com, somebodyelse@example.com"; $subject = "html email"; $message = " <html> <head> <title>html email</title> </head> <body> <p>this email contains html tags!</p> <table> <tr> <th>firstname</th> <th>lastname</th> </tr> <tr> <td>john</td> <td>doe</td> </tr> </table> </body> </html> "; // set content-type when sending html email $headers = "mime-version: 1.0" . "\r\n"; $headers .= "content-type:text/html;charset=utf-8" . "\r\n"; // more headers $headers .= 'from: <webmaster@example.com>' . "\r\n"; $headers .= 'cc: myboss@example.com' . "\r\n"; mail($to,$subject,$message,$headers); ?>
can reserve address point custom php file ?
is there way can achieved ?
you have options,
use com_contact overrides
copy entire components/com_contact/view/
templates/your_templates/html/com_contact/
.
then add custom styles following methods inside view page
$doc = jfactory::getdocument(); $doc->addscript('js file full path'); $doc->addstylesheet('css path');
it load custom styles have avoid header , footer feeling different page. can achieved using appending tmpl=component
url . contact url www.yourdomain.com/contact&tmpl=component
.
custom page article
create article page name , set alias required url. add form , required css within article content. here required plugin including styles , script inside article content this. in form action follows.
<form action = "index.php?option=com_contact&task=contact.contactinfo">...</form>
this stands inside components/com_contact/controllers/contact.php
have function contactinfo()
when form submit post data inside function.
for retrieving form data use joomla default library like
$jinput = jfactory::getapplication()->input; $name = $jinput->get('name', 'default_value', 'filter');
also sending email can use.
$mail = jfactory::getmailer(); $mail->addrecipient($contact->email_to); $mail->addreplyto(array($email, $name)); $mail->setsender(array($mailfrom, $fromname)); $mail->setsubject($sitename.': '.$subject); $mail->setbody($body); $sent = $mail->send();
after sending can redirect page .
$this->setredirect('url','message success/failed','type of message eg: error,info');
after setting can append &tmpl=component
above avoiding header , footer
hope make sense..
Comments
Post a Comment