Using Code in Posts doesn't work

Divinum Fiat

Well-known member
Hi all,

I'm trying to add an aWeber html code to a post by clicking the brackets. I tried saying "General Code" and "HTML" but neither shows up right. Here is what I enter:

<script type="text/javascript" src="http://forms.aweber.com/form/24/517111224.js"></script>

Am I missing something?

Alternatively, if this is not working within posts, is it possible to put the code in the sidebar? If so, how?

Thank you!
 
The code button in the editor is for sites like this where it's necessary to share and display code.

For example:

PHP:
public function isUserSuperAdmin(array $user)
{
$superAdmins = preg_split(
'#\s*,\s*#', XenForo_Application::get('config')->superAdmins,
-1, PREG_SPLIT_NO_EMPTY
);
return ($user['is_admin'] && in_array($user['user_id'], $superAdmins));
}

The code isn't supposed to execute, it's just there to display code.

What is the code supposed to do, and why would you want it in every post?

As ever, you would need to insert HTML code directly into a template.
 
Hi Chris, thanks for responding. It's a newsletter sign up to aWeber. So I wanted the form to show up under the post announcement, just in that particular post, not in every post. Hhhm. If that won't work, is there a way to get the form installed on the side bar?
 
Hi Chris, thanks for responding. It's a newsletter sign up to aWeber. So I wanted the form to show up under the post announcement, just in that particular post, not in every post. Hhhm. If that won't work, is there a way to get the form installed on the side bar?
You can still do this.

First of all, you need the post ID of the post that you want the form to appear in. You can get that by hovering over the permalink in the bottom right corner of the post. So, the post I've quoted is 404553.

You would then need to go to your "message" template.

Find: {xen:raw $messageContentAfterTemplate}

And below add:

<xen:if is="{$message.post_id} == XX">
<script type="text/javascript" src="http://forms.aweber.com/form/24/517111224.js"></script>
</xen:if>

(where XX is your post ID)


That should work.

This solution isn't ideal, and it's not something you'd be wanting to do regularly, but it will work.

Also, you would need to remember this in case of future XenForo updates. If XenForo updates that template, then you would need to remove the above code, revert the template and add the change back in.


EDIT: And after all that, Andy's solution is much more elegant:

Install Widget Framework addon and create a HTML sidebar where you can paste the code in.
Or you can create a BB Media code to embed your form. It's the same thing as youtube
 
Back
Top Bottom