ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

layout modification

raulmonda 31 Oct, 2011
Hi,

Im working on comments layout. What i need is every post to be rendered in a rectangle; if the post has a replay that replay must be also in a rectangle inside the parent rectangle. See http://www.lotusdiving.com/reviews
The problem is the child post (replay) needs a different (smaller) rectangle. I modified the php file comment-item.html.php as follows; new lines in bold at the beginning of the code, original code in black:


<?php
 if ($parent_select==0)
   {
  ?> 
   <table border="1" cellpadding="1" cellspacing="1" style="height: auto; width: 845px;"> 
 <?php
   } else  {
  ?> 
   <table border="1" cellpadding="1" cellspacing="1" style="height: auto; width: 300px;">
 <?php
  }
?>
<tr>
<td>
<div class="comment-item" id="commentID{comment_id}">
    	<div class="comment-item-header"><a name="commentID{comment_id}"></a>
        	<!--{a_comment_avatar}<img src="{comment_avatar}" alt="avatar" class="avatar" width="26" height="26" />{/a_comment_avatar}-->
            <{if_comment_url}a href="{comment_url}"{/if_comment_url} class="nickname-link">{comment_name}</{if_comment_url}a{/if_comment_url}>{if_user_reputation}<span class="bullet">•</span> <div class="rep-score"><div class="rep-score-left"></div><div class="rep-score-center">{user_reputation}</div><div class="rep-score-right"></div></div>{/if_user_reputation}
            <div class="rating">
            <div class="score" id="score{comment_id}">{comment_rating}</div> <div id="plus_{comment_id}" class="rating-plus" onmouseover="showPlus(this.id);" onClick="addPlus({comment_id});" onmouseout="hidePlus(this.id);"> </div> <div id="minus_{comment_id}" class="rating-minus" onmouseover="showMinus(this.id);" onClick="addMinus({comment_id});" onmouseout="hideMinus(this.id);"> </div> 
            </div>
	    <div class="date-raul" id="date_{comment_id}" {comment_datetime}</div> <!--I added this class in style.css to render the date in the comment header-->
        </div>
        <div class="comment-body">
        {comment_text}
		</div>
        <div class="comment-status">
        <!--<strong>{comment_datetime}</strong>-->
        <?php
		$Authorized = false;
		$user = JFactory::getUser();
		$configs = JComponentHelper::getParams('com_chronocomments');
		if(($user->id)&&(in_array($user->gid, (array)$configs->get('unpublish_groups')))) //authorize('com_chronocomments', 'unpublish') )
		{
			//JError::raiseError(403, JText::_('Access Forbidden'));
			$Authorized = true;
		}
		if($Authorized){
	
	?>
        <div class="comment-button" id="unpublish_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="unpublishComment({comment_id});">
        	<div class="comment-button-left" id="unpublish_{comment_id}_l"></div>
            <div class="comment-button-center" id="unpublish_{comment_id}_c"><?php echo JText::_( 'UNPUBLISH' ); ?></div>
            <div class="comment-button-right" id="unpublish_{comment_id}_r"></div>
        </div>
        <?php } ?>
		<?php
		$Authorized = false;
		$user = JFactory::getUser();
		$configs = JComponentHelper::getParams('com_chronocomments');
		if(($user->id)&&(in_array($user->gid, (array)$configs->get('edit_groups'))))
		{
			//JError::raiseError(403, JText::_('Access Forbidden'));
			$Authorized = true;
		}else{
		
	/*$row->load($post['commentid']);
			if(($user->id)&&($configs->get('user_edit_own') == '1')&&($user->id == $row->userid)){
				$Authorized = true;
			}*/
		}
		if($Authorized){
		?>
        <div class="comment-button" id="edit_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="editCommentForm({comment_id});">
        	<div class="comment-button-left" id="edit_{comment_id}_l"></div>
            <div class="comment-button-center" id="edit_{comment_id}_c"><?php echo JText::_( 'EDIT' ); ?></div>
            <div class="comment-button-right" id="edit_{comment_id}_r"></div>
        </div>
        <?php } ?>
        <?php
		$Authorized = false;
		$user = JFactory::getUser();
		$configs = JComponentHelper::getParams('com_chronocomments');
		if(($user->id)&&(in_array($user->gid, (array)$configs->get('posting_groups'))))
		{
			//JError::raiseError(403, JText::_('Access Forbidden'));
			$Authorized = true;
		}else{
			if(($user->guest)&&($configs->get('guests_post') == '1')){
				$Authorized = true;
			}
		}
		if($Authorized){
		?>
        <div class="comment-button" id="post_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="showCommentForm({comment_id});">
        	<div class="comment-button-left" id="post_{comment_id}_l"></div>
            <div class="comment-button-center" id="post_{comment_id}_c"><?php echo JText::_( 'POST_REPLY' ); ?></div>
            <div class="comment-button-right" id="post_{comment_id}_r"></div>
        </div>
        <?php } ?>
        </div>
        <div class="clear"></div>
        <?php
		$Authorized = false;
		$user = JFactory::getUser();
		$configs = JComponentHelper::getParams('com_chronocomments');
	
	if(($user->id)&&(in_array($user->gid, (array)$configs->get('edit_groups'))))
		{
			//JError::raiseError(403, JText::_('Access Forbidden'));
			$Authorized = true;
		}else{
			/*$row->load($post['commentid']);
			if(($user->id)&&($configs->get('user_edit_own') == '1')&&($user->id == $row->userid)){
				$Authorized = true;
			}*/
		}
		if($Authorized){
		?>
        <div id="edit_{comment_id}_form" class="comment-form">
        <fieldset>
        <form action="<?php if($configs->get('sh404SEF') == '1')echo JURI::Base(); ?><?php echo JRoute::_('index2.php?option=com_chronocomments&task=savecomment'); ?>" id="edit_ccform_{comment_id}" name="edit_ccform_{comment_id}" method="post" >
        <textarea id="edit_{comment_id}_text" name="text" cols="" rows="" class="form-text">{comment_text}</textarea>
        <input name="name" type="text" id="edit_ccname_{comment_id}" value="{comment_name}" class="form-input" /> <span class="input-text"><?php echo JText::_( 'NAME' ); ?> *</span><br />
        <input name="email" type="text" id="edit_ccemail_{comment_id}" value="{comment_email}" class="form-input" /> <span class="input-text"><?php echo JText::_( 'EMAIL_VERIFICATIONS_REPLIES' ); ?></span><br />
        <input name="url" type="text" id="edit_ccurl_{comment_id}" value="{comment_url}" class="form-input" /> <span class="input-text"><?php echo JText::_( 'URL' ); ?></span><br />
         
        <div class="clear"></div>
        <div class="comment-status">
        
        <div class="comment-button" id="submit_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="submiteditCommentForm({comment_id});">
        	<div class="comment-button-left" id="submit_{comment_id}_l"></div>
            <div class="comment-button-center" id="submit_{comment_id}_c"><?php echo JText::_( 'SAVE' ); ?></div>
            <div class="comment-button-right" id="submit_{comment_id}_r"></div>
        </div>
        <div class="comment-button" id="cancel_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="hideeditCommentForm({comment_id});">
        	<div class="comment-button-left" id="cancel_{comment_id}_l"></div>
            <div class="comment-button-center" id="cancel_{comment_id}_c"><?php echo JText::_( 'CANCEL' ); ?></div>
            <div class="comment-button-right" id="cancel_{comment_id}_r"></div>
        </div>
        </div>
        <input name="component" type="hidden" value="<?php echo $component; ?>" />
		<input name="pageid" type="hidden" value="<?php echo $pageid; ?>" />
		<input name="userid" type="hidden" value="{comment_userid}" />
		<input name="commentid" type="hidden" value="{comment_id}" />
        <input name="parentid" type="hidden" value="{comment_parentid}" />
        <?php echo JHTML::_( 'form.token' ); ?>
		</form>
        </fieldset>
        </div>
        <div class="clear1"></div>
        <?php } ?>
        <?php
		$Authorized = false;
		$user = JFactory::getUser();
		$configs = JComponentHelper::getParams('com_chronocomments');
		if(($user->id)&&(in_array($user->gid, (array)$configs->get('posting_groups'))))
		{
			//JError::raiseError(403, JText::_('Access Forbidden'));
			$Authorized = true;
		}else{
			if(($user->guest)&&($configs->get('guests_post') == '1')){
				$Authorized = true;
			}
		}
		if($Authorized){
		?>
        <div id="post_{comment_id}_form" class="comment-form">
        <div id="post_{comment_id}_form_loading" style="text-align:center; display:none;"><img src="<?php echo JURI::Base(); ?>components/com_chronocomments/loader<?php echo $configs->get('loaderimage_color', 'b') ?>.gif" /></div>
        <fieldset>
        <?php if(($configs->get('bbcode') == '1')&&($configs->get('showbbcodepanel') == '1')){ ?>            
            <div class="comment-button left" id="ccbb_b_{comment_id}" onmouseover="showShadow(this.id);" title="Bold text: text" onmouseout="hideShadow(this.id);" onclick="bbstyle(0, 'ccform_{comment_id}', 'post_{comment_id}_text')">
                <div class="comment-button-left" id="ccbb_b_{comment_id}_l"></div>
                <div class="comment-button-center" id="ccbb_b_{comment_id}_c"><strong>B</strong></div>
                <div class="comment-button-right" id="ccbb_b_{comment_id}_r"></div>
            </div>
            <div class="comment-button left" id="ccbb_i_{comment_id}" onmouseover="showShadow(this.id);" title="Italic text: text" onmouseout="hideShadow(this.id);" onclick="bbstyle(2, 'ccform_{comment_id}', 'post_{comment_id}_text')">
                <div class="comment-button-left" id="ccbb_i_{comment_id}_l"></div>
                <div class="comment-button-center" id="ccbb_i_{comment_id}_c"><em>i</em></div>
                <div class="comment-button-right" id="ccbb_i_{comment_id}_r"></div>
            </div>
            <div class="comment-button left" id="ccbb_u_{comment_id}" onmouseover="showShadow(this.id);" title="Underline text: text" onmouseout="hideShadow(this.id);" onclick="bbstyle(4, 'ccform_{comment_id}', 'post_{comment_id}_text')">
                <div class="comment-button-left" id="ccbb_u_{comment_id}_l"></div>
                <div class="comment-button-center" id="ccbb_u_{comment_id}_c">u</div>
                <div class="comment-button-right" id="ccbb_u_{comment_id}_r"></div>
            </div>
            <div class="comment-button left" id="ccbb_quote_{comment_id}" onmouseover="showShadow(this.id);" title="Quote text: 
text
" onmouseout="hideShadow(this.id);" onclick="bbstyle(6, 'ccform_{comment_id}', 'post_{comment_id}_text')"> <div class="comment-button-left" id="ccbb_quote_{comment_id}_l"></div> <div class="comment-button-center" id="ccbb_quote_{comment_id}_c">Quote</div> <div class="comment-button-right" id="ccbb_quote_{comment_id}_r"></div> </div> <div class="comment-button left" id="ccbb_code_{comment_id}" onmouseover="showShadow(this.id);" title="Code display:
code
" onmouseout="hideShadow(this.id);" onclick="bbstyle(8, 'ccform_{comment_id}', 'post_{comment_id}_text')"> <div class="comment-button-left" id="ccbb_code_{comment_id}_l"></div> <div class="comment-button-center" id="ccbb_code_{comment_id}_c">Code</div> <div class="comment-button-right" id="ccbb_code_{comment_id}_r"></div> </div> <div class="comment-button left" id="ccbb_list_{comment_id}" onmouseover="showShadow(this.id);" title="List: [list]text[/list]" onmouseout="hideShadow(this.id);" onclick="bbstyle(10, 'ccform_{comment_id}', 'post_{comment_id}_text')"> <div class="comment-button-left" id="ccbb_list_{comment_id}_l"></div> <div class="comment-button-center" id="ccbb_list_{comment_id}_c">List</div> <div class="comment-button-right" id="ccbb_list_{comment_id}_r"></div> </div> <div class="comment-button left" id="ccbb_list2_{comment_id}" onmouseover="showShadow(this.id);" title="Ordered list:
  • text
  • " onmouseout="hideShadow(this.id);" onclick="bbstyle(12, 'ccform_{comment_id}', 'post_{comment_id}_text')"> <div class="comment-button-left" id="ccbb_list2_{comment_id}_l"></div> <div class="comment-button-center" id="ccbb_list2_{comment_id}_c">List item</div> <div class="comment-button-right" id="ccbb_list2_{comment_id}_r"></div> </div> <div class="comment-button left" id="ccbb_url_{comment_id}" onmouseover="showShadow(this.id);" title='Insert URL: http://url or URL text' onmouseout="hideShadow(this.id);" onclick="bbstyle(16, 'ccform_{comment_id}', 'post_{comment_id}_text')"> <div class="comment-button-left" id="ccbb_url_{comment_id}_l"></div> <div class="comment-button-center" id="ccbb_url_{comment_id}_c">URL</div> <div class="comment-button-right" id="ccbb_url_{comment_id}_r"></div> </div> <div class="clear"></div> <?php } ?> <?php $my = JFactory::getuser(); ?> <form action="<?php if($configs->get('sh404SEF') == '1')echo JURI::Base(); ?><?php echo JRoute::_('index2.php?option=com_chronocomments&task=savecomment'); ?>" id="ccform_{comment_id}" name="ccform_{comment_id}" method="post" > <textarea id="post_{comment_id}_text" name="text" cols="" rows="" class="form-text"></textarea> <input name="name" <?php if(($configs->get('hidename') == '1')&&($my->username)){ ?>type="hidden"<?php }else{ ?>type="text"<?php } ?> id="ccname_{comment_id}" class="form-input" value="<?php echo $my->username; ?>" /><?php if(($configs->get('hidename') == '1')&&($my->username)){ ?> <?php }else{ ?> <span class="input-text"><?php echo JText::_( 'NAME' ); ?> *</span><br /><?php } ?> <?php if($configs->get('hideemail') != '1'){ ?> <input name="email" type="text" id="ccemail_{comment_id}" class="form-input" value="<?php $my = JFactory::getuser(); echo $my->email; ?>" /> <span class="input-text"><?php echo JText::_( 'EMAIL_VERIFICATIONS_REPLIES' ); ?></span><br /> <?php } ?> <?php if($configs->get('hideurl') != '1'){ ?> <input name="url" type="text" id="ccurl_{comment_id}" value="http://" class="form-input" /> <span class="input-text"><?php echo JText::_( 'URL' ); ?></span><br /> <?php } ?> <?php if($configs->get('captcha') == '1'){ ?> <input name="comment_captcha" type="text" size="5" style="width:30%" id="comment_captcha_{comment_id}" class="form-input" /> <span class="input-text"><?php echo JText::_( 'CODE' ); ?></span>   <img id="comment_captcha_img" class="comment_captcha_img" src="<?php echo JURI::Base(); ?>components/com_chronocomments/chrono_verification.php?imtype=<?php echo $configs->get('imtype'); ?>&anticache=<?php echo rand(1,99999); ?>"> <br /> <?php } ?> <div class="clear"></div> <div class="comment-status"> <div class="comment-button" id="submit_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="submitCommentForm({comment_id});"> <div class="comment-button-left" id="submit_{comment_id}_l"></div> <div class="comment-button-center" id="submit_{comment_id}_c"><?php echo JText::_( 'SUBMIT_COMMENT' ); ?></div> <div class="comment-button-right" id="submit_{comment_id}_r"></div> </div> <div class="comment-button" id="cancel_{comment_id}" onmouseover="showShadow(this.id);" onmouseout="hideShadow(this.id);" onclick="hideCommentForm({comment_id});"> <div class="comment-button-left" id="cancel_{comment_id}_l"></div> <div class="comment-button-center" id="cancel_{comment_id}_c"><?php echo JText::_( 'CANCEL' ); ?></div> <div class="comment-button-right" id="cancel_{comment_id}_r"></div> </div> </div> <input name="component" type="hidden" value="<?php echo $component; ?>" /> <input name="pageid" type="hidden" value="<?php echo $pageid; ?>" /> <input name="userid" type="hidden" value="<?php $my = JFactory::getuser(); echo $my->id; ?>" /> <input name="commentid" type="hidden" value="" /> <input name="parentid" type="hidden" value="{comment_id}" /> <?php echo JHTML::_( 'form.token' ); ?> </form> </fieldset> </div> <div class="clear1"></div> <?php } ?> {REPLIES} </div> </td> </tr> </table>

    You can see i added a table and a php variable as selector ($parent_select). Ive observed that in the comments table the replays have "parentid" equal to the parent whom belongs to. In other words the posts have always "parentid=0" while replays have "parentid !=0".
    Now i have to transfer the value of "parentid" loaded from database table to the variable "parent_select". Ive noticed that the comments are loaded in /plugin/ChronoComments.php using the function LoadComment($commentid, $comment_item) but from here i got lost.
    Please let me know how to transfer the value of "parentid" to my defined variable "parent_selector". If i can do that i assume i can render the comment and its replays in different ways.
    Thank you in advance.
    Regards,
    Raul
    This topic is locked and no more replies can be posted.

    2Checkout.com

    2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com