Go Back   Pligg Forum > Pligg Help > Wiki Articles
 
 
LinkBack Article Tools Display Modes
  #1 (permalink)  
Old 01-01-2008, 11:45 AM
AshDigg's Avatar
AshDigg AshDigg is offline
Mayor of PliggVille
 
Join Date: Dec 2005
Location: Pliggville
Posts: 1,646
Downloads: 34
Uploads: 10
Thanks: 237
Thanked 346 Times in 207 Posts
Upgrading a 9.8.2 template to 9.9

This area reserved.
__________________
- Ash
Reply With Quote
The Following 8 Users Say Thank You to AshDigg For This Useful Post:
Sponsored Links
  #2  

Upgrading a 9.8.2 template to 9.9

There were a number of template changes from 9.8.2 to 9.9. The main reasons for these changes are
  • Remove PHP code from the TPL files
  • Prepare them for 1.0 which will allow multiple languages

Many of the changes were done to help eliminate the need for the developers to force template changes in the future.

It is recommended you use a program like WinMerge to compare your template to the yget 9.9 template.

----------------------------------------------------------------

The most important changes are the ones that have to do with the lang.conf file.

EXAMPLE:
template_name.tpl
Changed
PHP Code:
{config_load file="/libs/lang.conf"
to
PHP Code:
{config_load file="/languages/lang_".$pligg_language.".conf"
EXAMPLE:
template_name.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}


----------------------------------------------------------------
/templates folder
----------------------------------------------------------------

meta.tpl
added
HTML Code:
<meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
blank.tpl
Changed
PHP Code:
{config_load file="/libs/lang.conf"
to
PHP Code:
{config_load file="/languages/lang_".$pligg_language.".conf"


----------------------------------------------------------------
/templates/yourtemplate/
----------------------------------------------------------------

template_details.php
Added a file containing information about your template.

404error.tpl
Moved to /templates

faq-en_center.tpl
Moved to /templates

bookmarklet.tpl
added to /templates

blank.tpl
Changed
PHP Code:
{config_load file="/libs/lang.conf"
to
PHP Code:
{config_load file="/languages/lang_".$pligg_language.".conf"
comment_form.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
changed line 5 to:
PHP Code:
<textarea name="comment_content" id="comment" rows="6" cols="60"/>{if isset($TheComment)}{$TheComment}{/if}</textarea
comment_show.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
line 11: Notice the location of the last ;
HTML Code:
{#PLIGG_Visual_Comment_Rating#}: <a id="cvote-{$comment_id}" style='text-decoration: none;'>{$comment_votes}</a>
line 43:
HTML Code:
<input type="hidden" name="randkey" value="{$rand}" />
edit_comment_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

editlink_edit_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
header.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
index_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

link_summary.tpl
added to line 137:
HTML Code:
{checkActionsTpl location="tpl_link_summary_admin_links"}
changed 178 to:
HTML Code:
(blank line here)
changed 179 to:
HTML Code:
<span id="linksummaryDiscuss"><a href="{$story_url}" class="comments">{#PLIGG_MiscWords_Discuss#}</a>  </span>
changed 182 to:
HTML Code:
<span id="linksummaryHasComment"><a href="{$story_url}" class="comments2">{$story_comment_count} {#PLIGG_MiscWords_Comment#}</a>  </span>
changed 183 to:
HTML Code:
(deleted this line)
changed 185 to:
HTML Code:
<span id="linksummaryHasComment"><a href="{$story_url}" class="comments2">{$story_comment_count} {#PLIGG_MiscWords_Comments#}</a>  </span>
changed 186 to:
HTML Code:
(deleted this line)
changed 190 to:
HTML Code:
<span id="linksummaryAddLink">
changed 191 to:
HTML Code:
<a href="javascript://" onclick="var replydisplay=document.getElementById('addto-{$link_shakebox_index}').style.display ? '' : 'none';document.getElementById('addto-{$link_shakebox_index}').style.display = replydisplay;"> {#PLIGG_Visual_LS_AddThisLinkTo#}</a> 
added line 192:
HTML Code:
</span>
changed 198 to:
HTML Code:
<span id="linksummarySaveLink"><a target="add_stories" href="{$user_url_add_links}" onclick="show_hide_user_links(document.getElementById('stories-{$link_shakebox_index}'));">{#PLIGG_MiscWords_Save_Links_Save#}</a> 
changed 201 to:
HTML Code:
<span id="linksummaryRemoveLink"><a target="add_stories" href="{$user_url_remove_links}" onclick="show_hide_user_links(document.getElementById('stories-{$link_shakebox_index}'));">{#PLIGG_MiscWords_Save_Links_Remove#}</a> 
The changed above are the result of taking multiple images, combining them into 1 image, and using CSS to show the
correct image.

changed 206 to:
HTML Code:
{if $Enable_Recommend eq 1 && $user_logged_in neq ""}
changed 208 to:
HTML Code:
<span id="linksummaryTellFriend">
added line 209:
HTML Code:
<a href="javascript://" onclick="show_recommend({$link_shakebox_index}, {$link_id}, '{$instpath}');"> {#PLIGG_Visual_Recommend_Link_Text#}</a>  
added line 210:
HTML Code:
</span>
changed 215 to:
HTML Code:
<span id="xreport-{$link_shakebox_index}"><span id="linksummaryBury"><a href="javascript:{$link_shakebox_javascript_report}">{#PLIGG_Visual_Vote_Bury#}</a></span></span>
removed line 234:
HTML Code:
</span>
added line 236:
HTML Code:
</span>
live_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
live_comments_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

live_published_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

live_unpublished_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

login_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
pligg.tpl
replace
HTML Code:
{config_load file="/libs/lang.conf"}
with
HTML Code:
{config_load file="/languages/lang_".$pligg_language.".conf"}
remove
HTML Code:
<meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
changed
HTML Code:
<!--[if lte IE 6]> <script src="{$my_pligg_base}/js/jspath.php" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="{$my_pligg_base}/templates/{$the_template}/css/ie6.css" media="screen" /> <script type="text/javascript">
			if (typeof blankImg == 'undefined') var blankImg = my_pligg_base + '/templates/{$the_template}/images/blank.gif';
		</script> <style type="text/css" media="screen">
		    body {literal}{{/literal}behavior:url({$my_pligg_base}/templates/{$the_template}/css/iehfix.htc); {literal}}{/literal}
			img {literal}{{/literal}behavior:url({$my_pligg_base}/templates/{$the_template}/css/iepngfix.htc); {literal}}{/literal}
	    </style> <![endif]-->
to
HTML Code:
{* this is an IE6 specific 'hack' for the yget template *}
		<!--[if lte IE 6]> <link rel="stylesheet" type="text/css" href="{$my_pligg_base}/templates/{$the_template}/css/ie6.css" media="screen" /> <script type="text/javascript">
				if (typeof blankImg == 'undefined') var blankImg = '{$my_pligg_base}/templates/{$the_template}/images/blank.gif';
			</script> <style type="text/css" media="screen">
				body {ldelim}behavior:url({$my_pligg_base}/templates/{$the_template}/css/iehfix.htc); {rdelim}
				img {ldelim}behavior:url({$my_pligg_base}/templates/{$the_template}/css/iepngfix.htc); {rdelim}
			</style> <![endif]-->
removed
HTML Code:
{literal}
		<script language="javascript" type="text/javascript">
			function openSpellChecker(commentarea) {
				var txt = document.getElementById(commentarea);
				var speller = new spellChecker( txt );
				speller.openChecker();
			}
		</script>
		{/literal}
removed
HTML Code:
{if $pagename eq "story"}
		{literal}
			<style type="text/css">
			  /* allow room for 3 columns */
			  div#idwhovotedwrapper ol {width: 35em; list-style-type: none; }
			  div#idwhovotedwrapper ol li {float: left; width: 10em; }
			  div#idwhovotedwrapper br { clear: left; }
			  div#idwhovotedwrapper div.whovotedwrapper { margin-bottom: 1em; }
			</style>
		{/literal}
	{/if}
removed (at the end of the file)
HTML Code:
<script src="{$my_pligg_base}/js/jspath.php" type="text/javascript"></script>
profile_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
changed line 10:
HTML Code:
<form method="POST" enctype="multipart/form-data" name="image_upload_form" action="{$form_action}">
added line 13:
HTML Code:
{$hidden_token_profile_change}
changed line 20:
HTML Code:
{$hidden_token_profile_change}
register_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

register_error.tpl
Removed

register_step_1.tpl
Removed

register_step_2.tpl
Removed

search_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
changed line 24:
HTML Code:
{$link_summary_output}
changed line 25: remove the extra spaces
Code:
< b r />< b r />
changed line 26:
HTML Code:
{$search_pagination}
removed lines 27, 28 & 29

settemplate_center.tpl
changed line 1:
HTML Code:
{$message}
changed line 2:
HTML Code:
{include file="templates.tpl"}
removed the rest of the lines in the file

sidebar.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
story_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
added into line 1:
HTML Code:
{literal}
	<style type="text/css">
		/* allow room for 3 columns */
		div#idwhovotedwrapper ol {width: 35em; list-style-type: none; }
		div#idwhovotedwrapper ol li {float: left; width: 10em; }
		div#idwhovotedwrapper br { clear: left; }
		div#idwhovotedwrapper div.whovotedwrapper { margin-bottom: 1em; }
	</style>
{/literal}
replaced
HTML Code:
{php}
	Global $db, $main_smarty, $link;
	$link->print_summary();
{/php}
with
HTML Code:
{$the_story}
replaced
HTML Code:
{php}
	Global $db, $main_smarty, $current_user, $CommentOrder;
	get_comments();	// the get_comments function is in the /story.php file
{/php}
with
HTML Code:
{$the_comments}
submit_errors.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
submit_step_1.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
submit_step_2.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
added into line 73:
HTML Code:
<option value = "">{#PLIGG_Visual_Submit2_CatInstructSelect#}
submit_step_3.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
replaced
PHP Code:
{php}
        Global 
$db$main_smarty$dblang$the_template$linkres$current_user;

        
$linkres=new Link;

        
$linkres->id=$link_id $_POST['id'];
        
        if(!
$linkres->verify_ownership($current_user->user_id)){
            die(
$main_smarty->get_config_vars('PLIGG_Visual_Submit2Errors_NoAccess'));
        }
        
        
$linkres->read(FALSE);

        if(
$linkres->votes($current_user->user_id) == && auto_vote == true) {
            
$linkres->insert_vote($current_user->user_id'10');
            
$linkres->store_basic();
            
$linkres->read(FALSE); 
        }
        
        
$linkres->category=$_POST['category'];
        
$linkres->title strip_tags(trim($_POST['title']));
        
$linkres->title_url makeUrlFriendly($linkres->title);
        
$linkres->tags tags_normalize_string(strip_tags(trim($_POST['tags'])));
        
$linkres->content strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow);
        
$linkres->content str_replace("\n"""$linkres->content);
    
// Steef 2k7-07 security fix start ----------------------------------------------------------
      
if(isset($_POST['link_field1'])){$linkres->link_field1 strip_tags(trim($_POST['link_field1']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field2'])){$linkres->link_field2 strip_tags(trim($_POST['link_field2']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field3'])){$linkres->link_field3 strip_tags(trim($_POST['link_field3']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field4'])){$linkres->link_field4 strip_tags(trim($_POST['link_field4']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field5'])){$linkres->link_field5 strip_tags(trim($_POST['link_field5']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field6'])){$linkres->link_field6 strip_tags(trim($_POST['link_field6']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field7'])){$linkres->link_field7 strip_tags(trim($_POST['link_field7']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field8'])){$linkres->link_field8 strip_tags(trim($_POST['link_field8']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field9'])){$linkres->link_field9 strip_tags(trim($_POST['link_field9']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field10'])){$linkres->link_field10 strip_tags(trim($_POST['link_field10']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field11'])){$linkres->link_field11 strip_tags(trim($_POST['link_field11']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field12'])){$linkres->link_field12 strip_tags(trim($_POST['link_field12']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field13'])){$linkres->link_field13 strip_tags(trim($_POST['link_field13']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field14'])){$linkres->link_field14 strip_tags(trim($_POST['link_field14']), Story_Content_Tags_To_Allow);}
      if(isset(
$_POST['link_field15'])){$linkres->link_field15 strip_tags(trim($_POST['link_field15']), Story_Content_Tags_To_Allow);}
    
// Steef 2k7-07 security fix end --------------------------------------------------------------
    
        
if(!isset($_POST['summarytext'])){
            
$linkres->link_summary utf8_substr(strip_tags(trim($_POST['bodytext']), Story_Content_Tags_To_Allow), 0StorySummary_ContentTruncate 1);
            
$linkres->link_summary str_replace("\n"""$linkres->link_summary);        
        } else {
            
$linkres->link_summary strip_tags(trim($_POST['summarytext']), Story_Content_Tags_To_Allow);
            
$linkres->link_summary str_replace("\n"""$linkres->link_summary);
            if(
strlen($linkres->link_summary) > StorySummary_ContentTruncate){
                
loghack('SubmitAStory-SummaryGreaterThanLimit''username: ' $_POST["username"].'|email: '.$_POST["email"], true);
                
$linkres->link_summary utf8_substr($linkres->link_summary0StorySummary_ContentTruncate 1);
                
$linkres->link_summary str_replace("\n"""$linkres->link_summary);
            }
        }
        
        if (
link_errors($linkres)) {
            return;
        }

        
$linkres->store();
        
tags_insert_string($linkres->id$dblang$linkres->tags);
        
check_actions('submit_step_3_after_first_store');
        
$linkres->read(FALSE);
        
$edit true;
        
$link_title $linkres->title;
        
$link_content $linkres->content;
        
$link_title stripslashes(strip_tags(trim($_POST['title'])));
        
$linkres->print_summary();
        
        
$main_smarty->assign('tags'$linkres->tags);
        if (!empty(
$linkres->tags)) {
            
$tags_words str_replace(","", "$linkres->tags);
            
$tags_url urlencode($linkres->tags);
            
$main_smarty->assign('tags_words'$tags_words);
            
$main_smarty->assign('tags_url'$tags_url);
        }

        if(isset(
$url)){
            
$main_smarty->assign('submit_url'$url);
        } else {
            
$main_smarty->assign('submit_url''');
        }
        
$main_smarty->assign('submit_url_title'$linkres->url_title);
        
$main_smarty->assign('submit_id'$linkres->id);
        
$main_smarty->assign('submit_type'$linkres->type());
        
$main_smarty->assign('submit_title'$link_title);
        
$main_smarty->assign('submit_content'$link_content);
        if(isset(
$trackback)){
            
$main_smarty->assign('submit_trackback'$trackback);
        } else {
            
$main_smarty->assign('submit_trackback''');
        }
            
{/
php
with
PHP Code:
{$the_story
topusers_center.tpl
Many changes. You'll probably be able to replace your file with the new one.

topusers_data.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
upcoming_center.tpl
removed:
HTML Code:
{config_load file="/libs/lang.conf"}
replace
PHP Code:
{php}
    global 
$db$dblang$globals$main_smarty$search$offset$from_where$page_size$link_id$linksum_sql$linksum_count;
    include(
'./libs/link_summary.php'); // this is the code that show the links / stories
    
echo '<br/><br/>';    
    
do_pages($rows$page_size"upcoming"); // show the "page" buttons at the bottom 
{/php
with (remove the extra spaces in the BR's)
Code:
{$link_summary_output}
< b r />< b r />
{$link_pagination}

user_center.tpl
changed line 77:
HTML Code:
<tr><th>{#PLIGG_Visual_Login_Username#}</th><th>{#PLIGG_Visual_User_Profile_Joined#}</th><th>{#PLIGG_Visual_User_Profile_Homepage#}</th><th>Add/Remove</th></tr>
removed line 81:
HTML Code: