Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: St8 - huhtikuu 13, 2008, 06:00:02 IP

Otsikko: inserting form object in echo statement in index.template.php
Kirjoitti: St8 - huhtikuu 13, 2008, 06:00:02 IP
Hi

I get the "Template Parse Error!" when I try and insert a form object into the echo statement where my footer is. I have already added the javascript script with the header tags

This is my code snippet that gets the error:

  echo '
</div>
<div id="footer"></div>
<div id="footerbox"/>
<ul id="footer_links">

<li><a href="compare_mobile_phones.html">Mobile Phones</a></li>
<li><a href="news.html">Latest News</a></li>
<li><a href="frequently_asked_questions.html">FAQs</a></li>
<li><a href="forum">Forum</a></li>
</ul>


<form id="subscribeform" method="post" action="/applications/">
<fieldset>
<legend>Email updates</legend>
<label for="email">Email address</label>
<input type="text" name="email" id="email" value=" enter your email" onfocus="clearBox(this, ' enter your email')" onblur="fillBox(this, ' enter your email')" />
<input name="list_id" type="hidden" value="12" />
<input name="emailsubject" type="hidden" value="RecycleNow updates signup notification" />
<input type="image" value="search" src="images/sign_up.gif" />
</fieldset>
</form>

<ul id="tc_links">


<li><a href="/copyright.html">&copy; Copyright</a></li>
<li><a href="/terms.html">T &amp; C</a></li>
<li><a href="/privacy.html">Privacy Policy</a></li>
<li><a href="/contact.html">Contact Us</a></li>
<li><a href="/media.html">Media</a></li>
<li><a href="/about_us.html">About Us</a></li>
<li><a href="/sitemap.html">Site map</a></li>
</ul>
    Projectorphoneshop.com - The next generation of mobile phones </div>
<div class="footer"><p>', theme_copyright(),'</p>
<br />';


This is the same code snippet that doesn't get the error because the form code isn't included

echo '
</div>
<div id="footer"></div>
<div id="footerbox"/>
<ul id="footer_links">

<li><a href="compare_mobile_phones.html">Mobile Phones</a></li>
<li><a href="news.html">Latest News</a></li>
<li><a href="frequently_asked_questions.html">FAQs</a></li>
<li><a href="forum">Forum</a></li>
</ul>

<ul id="tc_links">


<li><a href="/copyright.html">&copy; Copyright</a></li>
<li><a href="/terms.html">T &amp; C</a></li>
<li><a href="/privacy.html">Privacy Policy</a></li>
<li><a href="/contact.html">Contact Us</a></li>
<li><a href="/media.html">Media</a></li>
<li><a href="/about_us.html">About Us</a></li>
<li><a href="/sitemap.html">Site map</a></li>
</ul>
    Projectorphoneshop.com - The next generation of mobile phones </div>
<div class="footer"><p>', theme_copyright(),'</p>
<br />';

// Show the load time?
if ($context['show_load_time'])
echo ''. $txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'];


How can I insert this form code that causing the trouble



<form id="subscribeform" method="post" action="/applications/">
<fieldset>
<legend>Email updates</legend>
<label for="email">Email address</label>
<input type="text" name="email" id="email" value=" enter your email" onfocus="clearBox(this, ' enter your email')" onblur="fillBox(this, ' enter your email')" />
<input name="list_id" type="hidden" value="12" />
<input name="emailsubject" type="hidden" value="RecycleNow updates signup notification" />
<input type="image" value="search" src="images/sign_up.gif" />
</fieldset>
</form>


I need it in that place to appear correctly in my footer.

Thank you all. Im normally quite good at trial and error with php as im no coder but this one has caused me a few problems.

Thank for your time<

steven  :D
Otsikko: Re: inserting form object in echo statement in index.template.php
Kirjoitti: Eliana Tamerin - huhtikuu 13, 2008, 08:39:30 IP
It's probably this line:

<input type="text" name="email" id="email" value=" enter your email" onfocus="clearBox(this, ' enter your email')" onblur="fillBox(this, ' enter your email')" />

Try this instead:

<input type="text" name="email" id="email" value=" enter your email" onfocus="clearBox(this, \' enter your email\')" onblur="fillBox(this, \' enter your email\')" />
Otsikko: Re: inserting form object in echo statement in index.template.php
Kirjoitti: karlbenson - huhtikuu 13, 2008, 08:42:54 IP
Remember which set of quotes your using to echo, you need to escape natural occurances of those within the string.

eg
echo 'It\'s my birthday';
or
echo "Its's not \"my\" birthday";
Otsikko: Re: inserting form object in echo statement in index.template.php
Kirjoitti: St8 - huhtikuu 14, 2008, 07:15:57 AP
Thank you very much karlbenson and Eliana, it is working now :-) Thank you Eliana for giving me the solution and thank you karlbenson for explaining it :-)