Page 1 of 1

Newsletter code work in Footer?

Posted: Thu Jul 21, 2011 1:58 pm
by rjcuser
Hi

Is there any reason why the code copied from the Newsletter panel wouldn't work if I pasted it in to the footer?

Thanks

Cheers
Richard

Re: Newsletter code work in Footer?

Posted: Fri Jul 22, 2011 9:46 am
by Tony Barnes
/templates/yourtemplate/panels/SideNewsletterBox.html is 'driven' by includes/display/SideNewsletterBox.php - so the footer isn't going to generate teh correct globals (only 1 actually made by the looks of it).

Copy the contents of includes/display/SideNewsletterBox.php in includes/display/Footer.php

Code: Select all

if (!GetConfig('ShowMailingListInvite')) {
				$this->DontDisplay = true;
				return;
			}

			$output = "";
			$GLOBALS['SNIPPETS']['SideNewsletterBox'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("DefaultNewsletterSubscriptionForm");
and you should be ok

Re: Newsletter code work in Footer?

Posted: Sat Jul 23, 2011 7:45 am
by rjcuser
Thanks very much, much appreciated.

Cheers
Richard

Re: Newsletter code work in Footer?

Posted: Tue Jan 17, 2012 1:40 pm
by jkkk
I've tried this but it's not working. I've added the above line to the file "footer.php". But I'm not if I put them into the right place. Would you please advice me where to put these codes on.

Thank you.

Re: Newsletter code work in Footer?

Posted: Tue Jan 17, 2012 1:54 pm
by Tony Barnes
Drop it in immediately after

Code: Select all

	public function SetPanelSettings()
		{
and you should be up and running :D

Re: Newsletter code work in Footer?

Posted: Wed Jan 18, 2012 1:26 am
by jkkk
Thank you, Tony. But it's still not working. I'm running V.6.0.14. Is there anything else I should do? What I did was putting the below code into the file "Footer.html" in my template folder (..default/Panels/Footer.html). And did just what you explained by adding the code to Footer.php in ../includes/display.

Code: Select all

%%Panel.SideNewsletterBox%% 
Would you please help me out? Thank you so much.

Re: Newsletter code work in Footer?

Posted: Thu Jan 19, 2012 10:51 am
by Tony Barnes
Ah sorry - if you look back to the first question the OP was asking why copying the code from the SideNewsletterBox.html into Footer.html didn't work - so rather than using %%Panel.SideNewsletterBox%% in Footer.html, actually copy/paste the contents of SideNewsletterBox.html into your Footer.html wherever you want the box to appear.

Note that if you do this, there can only be 1 newsletter sign up position - i.e. not in the footer and in a side panel - as having 2 will make the JS fail on one of them, so the form won't submit correctly.