Newsletter code work in Footer?

For articles specific to version 6.x
Post Reply
rjcuser
Posts: 36
Joined: Fri Feb 12, 2010 8:32 pm

Newsletter code work in Footer?

Post 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
ISC Ultimate v6.1.1 - Windows 2003 Server IIS6 - PHP v5.2.13 - mySQL v5.0.51b

Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Newsletter code work in Footer?

Post 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

rjcuser
Posts: 36
Joined: Fri Feb 12, 2010 8:32 pm

Re: Newsletter code work in Footer?

Post by rjcuser »

Thanks very much, much appreciated.

Cheers
Richard
ISC Ultimate v6.1.1 - Windows 2003 Server IIS6 - PHP v5.2.13 - mySQL v5.0.51b

jkkk
Posts: 2
Joined: Tue Jan 17, 2012 1:34 pm

Re: Newsletter code work in Footer?

Post 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.

Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Newsletter code work in Footer?

Post by Tony Barnes »

Drop it in immediately after

Code: Select all

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

jkkk
Posts: 2
Joined: Tue Jan 17, 2012 1:34 pm

Re: Newsletter code work in Footer?

Post 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.

Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: Newsletter code work in Footer?

Post 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.

Post Reply