MyBB Community Forums
using a custom script in the portal... - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: using a custom script in the portal... (/thread-222891.html)

Pages: 1 2


using a custom script in the portal... - SamoanOnion - 2019-05-03

Hello,

I was wondering if you could display a custom script using the portal?  So I can make THIS look like THIS.
The devotional is actually a script that is displayed with a custom window.

It's a fresh install and I'm migrating to mybb, but I was wondering if it were possible.

Thanks.


RE: using a custom script in the portal... - .m. - 2019-05-03

assuming that required custom script is based on javascript
such scripts can be manually added by editing template for the portal

see MyBB Templates system


RE: using a custom script in the portal... - SamoanOnion - 2019-05-03

I actually setup a global template, but am not sure how to use it or display it.


RE: using a custom script in the portal... - .m. - 2019-05-03

what exactly you have added in a new global template ?

I prefer using template conditionals plugin to load content
of a global template
at required location of other template


RE: using a custom script in the portal... - SamoanOnion - 2019-05-03

I just added the script that I want to display and was trying to figure out how to display it if I did it right.

<!--Begin SermonAudio Link Button-->
  <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="http://www.sermonaudio.com/code_spurgeon.asp?titlecolor=123154"></SCRIPT>
<!--End SermonAudio Link Button-->



RE: using a custom script in the portal... - .m. - 2019-05-03

^ that code can be added into any template between existing <head> and </head> codes

if you wanted it on the portal page then
you can edit portal template & add that required code just above </head>


RE: using a custom script in the portal... - SamoanOnion - 2019-05-03

I actually tried that an it didn't work.

I went to Templates > Default Templates > Portal Templates
and edited Portal and put that code right before the </head> tag and it didn't show anything.

also tried it in the Index as well with no luck.

also tried to enable html in a forum post and I couldn't get the code to work, it would just show the code.


RE: using a custom script in the portal... - Serpius - 2019-05-03

(2019-05-03, 10:34 AM)SamoanOnion Wrote: I actually tried that an it didn't work.

I went to Templates > Default Templates > Portal Templates
and edited Portal and put that code right before the </head> tag and it didn't show anything.

also tried it in the Index as well with no luck.

also tried to enable html in a forum post and I couldn't get the code to work, it would just show the code.

I'm not an expert on this, but if you are attempting to modify the portal.php, then you must use PHP coding.

Go to this WEBPAGE and look at their first example. (this is using PHP 7.2.xx. Don't bother learning PHP 5.xx.xx because it's slowly being deprecated)

Hopefully, that will solve your issue.


RE: using a custom script in the portal... - .m. - 2019-05-03

I have tested the given code & it has worked for me on the portal page.
[ temporary test link is sent through PM ]


RE: using a custom script in the portal... - SamoanOnion - 2019-05-03

I understand what you mean, but the code that I'm editing is HTML (I believe)

here is the code with my script inserted:
<html>
<head>
<title>{$mybb->settings['bbname']}</title>
<link rel="alternate" type="application/rss+xml" title="{$lang->latest_announcements} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php?portal=1" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_announcements} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?portal=1&type=atom1.0" />
{$headerinclude}

<!--Begin SermonAudio Link Button-->
  <SCRIPT LANGUAGE="JavaScript" type="text/javascript" src="http://www.sermonaudio.com/code_spurgeon.asp?titlecolor=123154"></SCRIPT>
<!--End SermonAudio Link Button--> 
 
</head>
<body>
{$header}
<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0" align="center">
<tr><td valign="top" width="200">
{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
</td>
<td>&nbsp;</td>
<td valign="top">
{$announcements}
{$multipage}
</td>
</tr>
</table>
{$footer}
</body>
</html>

I also tried it with the PHP tags and it still didn't work.

Thanks, I got the link
not sure what I'm doing wrong then, is the code correct in the above post?

quick side note, I'm trying to use HTML in a post, are the tags:
[html] [/html]