TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 141
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 103
  • Total: 103

I need a way to get around editing every index.template.php of every theme

Started by brianjw, February 12, 2007, 01:29:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

brianjw

I use the F1 Menu script, nneonneos shoutbox, and these tab content scripts that I have to put in each and every index.template.php or it wont work right :o And I have alot of themes and am adding alot constantly...... :smiley6600:
Here are the codes seprately of what I have to add, it also tells where if you look above the code......
Is there a way I can put all those codes into a file called required.template.php and I can add one line of code to some place in the index.template.php files that will direct it to that file and will get the code (this must be able to work with the head and body tags and tell it where it is supposed to put these lines of code ;))
Code (index.template.php right before the </head> tag) Select

<link rel="stylesheet" type="text/css" href="http://path-to-peace.com/forum/tabcontent.css" />

<script type="text/javascript" src="http://brianjwilson.com/tabs/tabcontent.js">

/***********************************************
* Tab Content script- Ã,© Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

Code (index.template.php right before the </body> tag) Select

<script type="text/javascript">
initializetabcontent("maintab", "maintab1", "maintab2")
</script>

Code (index.template.php right after the <body> tag) Select

include( 'menu.php' );

Code (index.template.php. I have attached the file and search for this line of code to find out where it goes inside of the file) Select

// YSHOUT HERE
if($context['user']['is_logged'])
echo '
<script src="yshout/js/prototype.js" type="text/javascript"></script>
<script src="yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="yshout/js/behaviour.js" type="text/javascript"></script>
<script src="yshout/js/domFunction.js" type="text/javascript"></script>
<script type="text/javascript">

var myfunc = new domFunction(function()
{
',empty($options['collapse_header']) ? 'loadChat();':'','
}, { "yshout":"id"});

</script>
<script src="yshout/js/yshout.js?Oct112006" type="text/javascript"></script>
<script type="text/javascript">var shoutFile = "home.txt";</script>
<style type="text/css">
#yshout {
font-size: 10px;
}
#yshout p {
margin: 0 0 0; /* Top Bottom Linespacing */
}
.shout-invalid {
background: #FFFDD1;
}
#yshout fieldset {
border: none;
}
#yshout em {
font-style: normal;
}
#yshout p {
line-height: 1;
margin-top: 0;
}
#yshout {
overflow: hidden;
}
#yshout .shout-timestamp {
font-weight: normal;
color: #fff;
}
#forum-name, #shout-text, #shout-button {
font-size: 9px;
margin: 0;
padding: 0;
}
#yshout #forum-name {
color: #666666;
width: 70px;
margin-right: 5px;
}
#yshout #shout-text {
color: #ffffff;
width: 310px;
margin-right: 5px;
}
#yshout #shout-button {
width: 55px;
}
#shouts .owner a {
color: #F00;
}
#shouts .moderator a {
color: #00F;
}
</style>';
// YSHOUT END

Code (index.template.php. I have attached the file and search for this line of code to find out where it goes inside of the file) Select

// YSHOUT HERE
document.getElementById("yshout").style.display = mode ? "none" : "";
if(!mode)
{
loadChat();
}
// YSHOUT END

  • Is there a way I can put all those codes into a file called required.template.php and I can add one line of code to some place in the index.template.php files that will direct it to that file and will get the code (this must be able to work with the head and body tags and tell it where it is supposed to put these lines of code ;))
  • Or is there a way I can put these codes in a block... I want aku to help me with the tabscontent codes so please if you would like to help let aku do those few because the tab content gets screwed up with all these weird things, lol :2funny:

    Thanks for your wonderful help! :D

    Brianjw

IchBin

Of course you can Brian. Put them into a file a php file and just include them

include('filename.php');

brianjw

Quote from: IchBinÃ,â,,¢ on February 12, 2007, 01:36:06 AM
Of course you can Brian. Put them into a file a php file and just include them

include('filename.php');
My question is how to set it up. Do I have to do that for each code I posted? or... How does it know which codes and where they go?

Brianjw

brianjw

Quote from: brianjw on February 12, 2007, 01:45:00 AM
Quote from: IchBinÃ,â,,¢ on February 12, 2007, 01:36:06 AM
Of course you can Brian. Put them into a file a php file and just include them

include('filename.php');
My question is how to set it up. Do I have to do that for each code I posted? or... How does it know which codes and where they go?

Brianjw
?

Brianjw

JPDeni

You need to have a separate file for each block of code and an "include" for each file. Some of those blocks of code are so small, you might as well leave them as they are.

As to how it knows where they go, you put an "include" statement in place of the block of code. Like, you take


// YSHOUT HERE
if($context['user']['is_logged'])
echo '
<script src="yshout/js/prototype.js" type="text/javascript"></script>
<script src="yshout/js/moo.ajax.js" type="text/javascript"></script>
<script src="yshout/js/behaviour.js" type="text/javascript"></script>
<script src="yshout/js/domFunction.js" type="text/javascript"></script>
<script type="text/javascript">

var myfunc = new domFunction(function()
{
',empty($options['collapse_header']) ? 'loadChat();':'','
}, { "yshout":"id"});

</script>
<script src="yshout/js/yshout.js?Oct112006" type="text/javascript"></script>
<script type="text/javascript">var shoutFile = "home.txt";</script>
<style type="text/css">
#yshout {
font-size: 10px;
}
#yshout p {
margin: 0 0 0; /* Top Bottom Linespacing */
}
.shout-invalid {
background: #FFFDD1;
}
#yshout fieldset {
border: none;
}
#yshout em {
font-style: normal;
}
#yshout p {
line-height: 1;
margin-top: 0;
}
#yshout {
overflow: hidden;
}
#yshout .shout-timestamp {
font-weight: normal;
color: #fff;
}
#forum-name, #shout-text, #shout-button {
font-size: 9px;
margin: 0;
padding: 0;
}
#yshout #forum-name {
color: #666666;
width: 70px;
margin-right: 5px;
}
#yshout #shout-text {
color: #ffffff;
width: 310px;
margin-right: 5px;
}
#yshout #shout-button {
width: 55px;
}
#shouts .owner a {
color: #F00;
}
#shouts .moderator a {
color: #00F;
}
</style>';
// YSHOUT END


and save it to a file called yshout.php. Save it to your smf root directory. In the place where you had all that code, put the line


include("yshout.php");


which just tells the script to go fetch that file and stick it in that place. You will have to do it with every one of your index.template.php files.

You might want to consider not having so many different themes if editing them all is that much of a pain. It's better, IMO, to have a signature style for your site.

This website is proudly hosted on Crocweb Cloud Website Hosting.