TinyPortal

Development => Support => Topic started by: cubsfanbudmn on May 30, 2007, 12:38:55 AM

Title: Template Error use TP heavily modified forum
Post by: cubsfanbudmn on May 30, 2007, 12:38:55 AM
Parse error: parse error, unexpected $ in .../Themes/default/Post.template.php on line 161

152:             if (typeof(smf_codeFix) != "undefined")
153:                smf_codeFix();
154:          }';
155:
156:    // A function needed to discern HTML entities from non-western characters.
157:    echo '
158:          function saveEntities()
159:          {
160:             var textFields = ["subject", "message", "guestname", "evtitle", "question"];
161:             for (i162:
163:
Title: Re: Template Error use TP heavily modified forum
Post by: IchBin on May 30, 2007, 06:29:47 AM
can you post the last few lines again as it seems your missing stuff.
Title: Re: Template Error use TP heavily modified forum
Post by: cubsfanbudmn on May 30, 2007, 06:58:03 AM
Im not sure what i need to do to help you there. Im still pretty new to SMF and TP to get what you need where do i look. I took the above lines from the error page that im getting.

I do Thank you for the help !!!!!


Below is what i took from my folder for the post template i think thats what your asking for thats the whole code that was in that section when i opened the post template file.
Title: Re: Template Error use TP heavily modified forum
Post by: cubsfanbudmn on May 30, 2007, 07:03:58 AM
<?php
// Version: 1.1; Post

// The main template for the post page.
function template_main()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;

if ($context['show_spellchecking'])
echo '
<script language="JavaScript" type="text/javascript" src="'
, $settings['default_theme_url'], '/spellcheck.js"></script>';

// Start the javascript... and boy is there a lot.
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA['
;

// Start with message icons - and any missing from this theme.
echo '
var icon_urls = {'
;
foreach ($context['icons'] as $icon)
echo '
"'
, $icon['value'], '": "', $icon['url'], '"', $icon['is_last'] ? '' : ',';
echo '
};'
;

// The actual message icon selector.
echo '
function showimage()
{
document.images.icons.src = icon_urls[document.forms.postmodify.icon.options[document.forms.postmodify.icon.selectedIndex].value];
}'
;
// The functions used to preview a posts without loading a new page.
echo '
var current_board = '
, empty($context['current_board']) ? 'null' : $context['current_board'], ';
var make_poll = '
, $context['make_poll'] ? 'true' : 'false', ';
var txt_preview_title = "'
, $txt['preview_title'], '";
var txt_preview_fetch = "'
, $txt['preview_fetch'], '";
function previewPost()
{
if (window.XMLHttpRequest)
{'
, $context['browser']['is_firefox'] ? '
// Firefox doesn\'t render <marquee> that have been put it using javascript
if (document.forms.postmodify.elements["message"].value.indexOf("[move]") != -1)
{
return submitThisOnce(document.forms.postmodify);
}'
: '', '
// Opera didn\'t support setRequestHeader() before 8.01.
if (typeof(window.opera) != "undefined")
{
var test = new XMLHttpRequest();
if (typeof(test.setRequestHeader) != "function")
return submitThisOnce(document.forms.postmodify);
}
// !!! Currently not sending poll options and option checkboxes.
var i, x = new Array();
var textFields = ["subject", "message", "icon", "guestname", "email", "evtitle", "question", "topic"];
var numericFields = [
"board", "topic", "num_replies",
"eventid", "calendar", "year", "month", "day",
"poll_max_votes", "poll_expire", "poll_change_vote", "poll_hide"
];
var checkboxFields = [
"ns",
];

for (i in textFields)
if (document.forms.postmodify.elements[textFields[i]])
x[x.length] = textFields[i] + "=" + escape(textToEntities(document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B");
for (i in numericFields)
if (document.forms.postmodify.elements[numericFields[i]] && typeof(document.forms.postmodify[numericFields[i]].value) != "undefined")
x[x.length] = numericFields[i] + "=" + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
for (i in checkboxFields)
if (document.forms.postmodify.elements[checkboxFields[i]] && document.forms.postmodify.elements[checkboxFields[i]].checked)
x[x.length] = checkboxFields[i] + "=" + document.forms.postmodify.elements[checkboxFields[i]].value;

sendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);

document.getElementById("preview_section").style.display = "";
setInnerHTML(document.getElementById("preview_subject"), txt_preview_title);
setInnerHTML(document.getElementById("preview_body"), txt_preview_fetch);

return false;
}
else
return submitThisOnce(document.forms.postmodify);
}
function onDocSent(XMLDoc)
{
if (!XMLDoc)
{
document.forms.postmodify.preview.onclick = new function ()
{
return true;
}
document.forms.postmodify.preview.click();
}

// Show the preview section.
var i, preview = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("preview")[0];
setInnerHTML(document.getElementById("preview_subject"), preview.getElementsByTagName("subject")[0].firstChild.nodeValue);

var bodyText = "";
for (i = 0; i < preview.getElementsByTagName("body")[0].childNodes.length; i++)
bodyText += preview.getElementsByTagName("body")[0].childNodes[i].nodeValue;

setInnerHTML(document.getElementById("preview_body"), bodyText);
document.getElementById("preview_body").className = "post";

// Show a list of errors (if any).
var errors = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("errors")[0];
var numErrors = errors.getElementsByTagName("error").length, errorList = new Array();
for (i = 0; i < numErrors; i++)
errorList[errorList.length] = errors.getElementsByTagName("error")[i].firstChild.nodeValue;
document.getElementById("errors").style.display = numErrors == 0 ? "none" : "";
document.getElementById("error_serious").style.display = errors.getAttribute("serious") == 1 ? "" : "none";
setInnerHTML(document.getElementById("error_list"), numErrors == 0 ? "" : errorList.join("<br />"));

// Show a warning if the topic has been locked.
document.getElementById("lock_warning").style.display = errors.getAttribute("topic_locked") == 1 ? "" : "none";

// Adjust the color of captions if the given data is erroneous.
var captions = errors.getElementsByTagName("caption"), numCaptions = errors.getElementsByTagName("caption").length;
for (i = 0; i < numCaptions; i++)
if (document.getElementById("caption_" + captions[i].getAttribute("name")))
document.getElementById("caption_" + captions[i].getAttribute("name")).style.color = captions[i].getAttribute("color");

if (errors.getElementsByTagName("post_error").length == 1)
document.forms.postmodify.message.style.border = "1px solid red";
else if (document.forms.postmodify.message.style.borderColor == "red" || document.forms.postmodify.message.style.borderColor == "red red red red")
{
if (typeof(document.forms.postmodify.message.runtimeStyle) == "undefined")
document.forms.postmodify.message.style.border = null;
else
document.forms.postmodify.message.style.borderColor = "";
}

// Set the new number of replies.
if (document.forms.postmodify.elements["num_replies"])
document.forms.postmodify.num_replies.value = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("num_replies")[0].firstChild.nodeValue;

var newPosts = XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("new_posts")[0] ? XMLDoc.getElementsByTagName("smf")[0].getElementsByTagName("new_posts")[0].getElementsByTagName("post") : {length: 0};
var numNewPosts = newPosts.length;
if (numNewPosts != 0)
{
var newTable = \'<span id="new_replies"></span><table width="100%" class="windowbg" cellspacing="0" cellpadding="2" align="center" style="table-layout: fixed;">\';
for (i = 0; i < numNewPosts; i++)
newTable += \'<tr class="catbg"><td colspan="2" align="left" class="smalltext"><div style="float: right;">'
, $txt[280], ': \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \' <img src="\' + smf_images_url + \'/', $context['user']['language'], '/new.gif" alt="', $txt['preview_new'], '" /></div>', $txt[279], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</td></tr><tr class="windowbg2"><td colspan="2" class="smalltext" id="msg\' + newPosts[i].getAttribute("id") + \'" width="100%"><div align="right" class="smalltext"><a href="#top" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');">', $txt[260], '</a></div><div class="post">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'</div></td></tr>\';
newTable += \'</table>\';
setOuterHTML(document.getElementById("new_replies"), newTable);
}

if (typeof(smf_codeFix) != "undefined")
smf_codeFix();
}'
;

// A function needed to discern HTML entities from non-western characters.
echo '
function saveEntities()
{
Title: Re: Template Error use TP heavily modified forum
Post by: IchBin on May 30, 2007, 07:11:46 AM
The error is telling you that theres an error on line 161 of post.template.php. The code you seem to be posting does not finish. You are either leaving out the rest of the code, or your file is missing the code.
Title: Re: Template Error use TP heavily modified forum
Post by: cubsfanbudmn on May 30, 2007, 07:14:42 AM
I would say i missing the rest of the code i copyied everything that was there. This all happened when i tryed using the free smileys mod. for some reason it screwed up. I have it on 2 other forums with all the same mods and got an error at 1 of the 3.  Just so happens the one forum that i forgot to make a back up for. DOH screwed up bad on that. Thanks again for the help.
Title: Re: Template Error use TP heavily modified forum
Post by: cubsfanbudmn on May 30, 2007, 07:49:13 AM
Thanks got it fixed i just went and copyied the post template from one of the working forums. Wish i would have thought of that 6 hours ago.I do apprectiate your time though !!!!!!
Title: Re: Template Error use TP heavily modified forum
Post by: G6Cad on May 30, 2007, 07:58:34 AM
Glad you got it sorted out :)
Title: Re: Template Error use TP heavily modified forum
Post by: cubsfanbudmn on May 30, 2007, 08:03:34 AM
Ty too everyone that helps all us that are new to smf the support from the communitys are the best ive seen from any forum package and i just want to say you all are the best !!!! SMF and TP is the wave of the future !!!  Best communitys on the net !!!!