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
Header and Footer PHP Includes in view-functions.php
Started 16 years ago by mafoster | 4 posts |
-
Hi There,
I am a new user of this software and like it a lot so far except for its difficulty if adapting to my current website(s).
I already have a design built in modules using PHP includes and XHTML/CSS. All I want to do is add my sites header and footer php includes (header.php and footer.php) to the view-functions.php file and make a few changes to the view.css file.
I know some of may say to use the advanced embeding options, but this will not do for me as my client has no will to edit any code and simply wants to create a new form for signups as needed with the same look as the rest of the site.
In the view-functions.php file, starting on line 1825 there is the XHTML code of the form. For some odd reason, when I try to add a PHP include, it will not load it. Here is an example of my code starting from line 1825:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>{$form->name}</title>
<link rel="stylesheet" type="text/css" href="{$css_dir}view.css" media="all" />
<script type="text/javascript" src="js/view.js"></script>
<?php include("http://localhost/llac-latest/includes/config.php"); ?>
{$calendar_js}
</head>
<body id="main_body" {$embed_class}>
<?php include("http://localhost/llac-latest/includes/header.php"); ?>
<div id="form_container"><h1>{$form->name}</h1>
<form id="form_{$form->id}" class="appnitro" {$form_enc_type} method="post" action="#main_body">
{$form_desc_div}
<ul {$ul_class}>
{$form->error_message}
{$all_element_markup}
{$custom_element}
{$button_markup}</form>
</div>
<img id="bottom" src="images/bottom.png" alt="" />
</body>
</html>Ideally I would also be able to use relative paths rather than absolute.
If anyone could give me a hand to how to make this work, I would be a happy camper and truly see the value in this software!
Thanks,
MarcPosted 16 years ago # -
Hmm.. I'm not sure why using the advanced code wouldn't work. No need to edit an existing file/code.
You can simply create a new php file, let say myform.phpThen inside myform.php, you can have these codes:
<?php include("http://localhost/llac-latest/includes/header.php"); ?> <?php ... put machform embed code here .. ?> <?php include("http://localhost/llac-latest/includes/footer.php"); ?>
Or am I missing something?
MachForm Founder
Posted 16 years ago # -
The problem I had with the advanced code is that their is an form ID which means I cannot create a template. My client does not want to edit code at all. I have created XHTML/PHP based Dreamweaver templates they update using Contribute. So having an ID there does not allow me to create a template where they can create a new form easily with my design. What I want is to be able to create a new form from within MachForm where the look and feel of the website is already there and all they need to do is link the form on the website. As I mentioned in my last post, I have includes for the header and footer which I would like to add to the MachForm application so that can be done.
Notice in the code posted above that I have added at two locations PHP Includes as follows:
<?php include("http://localhost/llac-latest/includes/header.php"); ?>
Seems like it should be possible to achieve? Any help would be appreciated!Thanks!
Posted 16 years ago # -
Ah.. I see.
Ok, try to do this.Around line 1825, you'll find this:
$form_markup = <<<EOT
right above that code insert these codes:
ob_start(); require('includes/myheader.php'); $header_output = ob_get_contents(); ob_end_clean(); ob_start(); require('includes/myfooter.php'); $footer_output = ob_get_contents(); ob_end_clean();
make sure to adjust the path of header and footer files above with your own.
Then you can use two variables above ($header_output and $footer_ouput) into the form template, like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>{$form->name}</title> <link rel="stylesheet" type="text/css" href="{$css_dir}view.css" media="all" /> <script type="text/javascript" src="js/view.js"></script> {$calendar_js} </head> <body id="main_body" {$embed_class}> <img id="top" src="images/top.png" alt="" /> {$header_output} <div id="form_container"> <h1><a>{$form->name}</a></h1> <form id="form_{$form->id}" class="appnitro" {$form_enc_type} method="post" action="#main_body"> {$form_desc_div} <ul {$ul_class}> {$form->error_message} {$all_element_markup} {$custom_element} {$button_markup} </ul> </form> <div id="footer"> Powered by <a href="http://www.appnitro.com">MachForm</a> </div> {$footer_output} </div> <img id="bottom" src="images/bottom.png" alt="" /> </body> </html>
MachForm Founder
Posted 16 years ago #
Reply
You must log in to post.