daniel-not-dan Posted May 5, 2013 Share Posted May 5, 2013 There is a site I'm working on right now and am trying to integrate this contact form from CSS-Tricks.com. The page I'm working on is here: http://accentguru.com/development/book-a-session/ (click the green "Ask Me Anything" button half-way down the page). The "action" for the form is to run contactengine.php, which is in the same /inc/ folder as the contact form pop-up itself, so I have it set up like this: <form method="post" action="<?php echo $config->urls->templates; ?>inc/contactengine.php"> The only way I can get it to run without a 403 error is to comment out this line in .htaccess: RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ [OR] The only reason I figured that out was because the comment above that line says "Block access to any PHP or markup files in /site/templates/". I'm not really up to speed on the ins and outs of the htaccess file otherwise. Is there anyone who can explain to me why I shouldn't comment this line out (I assume it's important), and if I shouldn't, is there some other way to allow the contactengine.php file to run? And, for that matter, why isn't it running right now? BTW - I realize there's a handy-dandy form Module that is available for purchase, but I figured it was over and above what was needed for a simple contact form. Thanks! Link to comment Share on other sites More sharing options...
diogo Posted May 5, 2013 Share Posted May 5, 2013 That line is there for a very good reason, you don't want people accessing your template files directly like you just did. don't remove it. The best way to do what you want is to create a template with that contactengine.php file, and then a page with that template (lat's say you name it "contactengine"). Then you can do this: <form method="post" action="<?php echo $pages->get("/contactengine/")->url;?>"> 2 Link to comment Share on other sites More sharing options...
kongondo Posted May 5, 2013 Share Posted May 5, 2013 Btw, Is there any advantage/disadvantage of using $pages->get()->url; over $config->urls->root? as shown below? <form method="post" action="<?php echo $pages->get("/contactengine/")->url;?>"> versus <form method="post" action="<?php echo $config->urls->root?>contactengine/"> Thanks Link to comment Share on other sites More sharing options...
daniel-not-dan Posted May 5, 2013 Author Share Posted May 5, 2013 That is face-palming-ingly simple. Thanks once again Diogo! Link to comment Share on other sites More sharing options...
apeisa Posted May 6, 2013 Share Posted May 6, 2013 Btw, Is there any advantage/disadvantage of using $pages->get()->url; over $config->urls->root? as shown below? <form method="post" action="<?php echo $pages->get("/contactengine/")->url;?>"> versus <form method="post" action="<?php echo $config->urls->root?>contactengine/"> Thanks I think first one is cleaner, but both of those will fail, if you change your page's parent. You could try this also: $pages->get(1234)->url where 1234 is page id. 2 Link to comment Share on other sites More sharing options...
kongondo Posted May 6, 2013 Share Posted May 6, 2013 Thanks Apeisa. I didn't think of that Link to comment Share on other sites More sharing options...
ryan Posted May 7, 2013 Share Posted May 7, 2013 Is there any advantage/disadvantage of using $pages->get()->url; over $config->urls->root? as shown below? If $config->urls->root will suffice for a given situation, it is potentially a lot less overhead to use it. When you access $config->urls->[anything] you are just accessing already-loaded properties. When you access $pages->get($id)->url, you are triggering a page load, if the page isn't already loaded. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now