This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

How to give replies a custom box?
#1

I'm currently trying to customize the appearance, and I stumbled upon trouble when I was trying to edit the reply area. Basically I want to have the reply area a custom background and a different padding than the normal comment box.

I was trying to do this with the .reply_indent, but this div lies underneath the comment box div. What I would like to have is a custom box for replies, like the admin_comment_box_1, however I do not have any knowledge of php, so if anyone could help it would be great.

I think it should be added in the following area:

PHP Code:
<?php 
for ($i = 1; $i <= cmtx_get_reply_depth($id); $i++) {
if (
$settings->reply_arrow && $i == cmtx_get_reply_depth($id)) {
$box .= "<div class='reply_arrow'>"; //add the reply arrow
}
$box .= '<div class="reply_indent">'; //indent the reply
}

if (
$alternate == 1) { //if it's the first box
if ($is_admin) {
$box .= "<div class='admin_comment_box_1'>"; //admin box
} else {
$box .= "<div class='comment_box_1'>"; //normal box
}
} else {
//if it's the second box
if ($is_admin) {
$box .= "<div class='admin_comment_box_2'>"; //admin box
} else {
$box .= "<div class='comment_box_2'>"; //normal box
}
}

So I was trying to make it look like this, but as I said, I do not have any php knowledge, and I don't know how to trigger the reply and the else (statement it is called i believe?):
PHP Code:
<?php 
if ($alternate == 1) { //if it's the first box
if ($is_admin) {
$box .= "<div class='admin_comment_box_1'>"; //admin box
} else {
if (
$REPLY) {
$box .= "<div class='reply_box_1'>"; //this would be the box im looking for :)
} else {
$box .= "<div class='comment_box_1'>"; //normal box
}

It would be great if anyone could help.
Reply
#2

Hi,

I haven't looked at the reply code in a while but I think you would use something like this:
PHP Code:
<?php 
if (cmtx_get_reply_depth($id) != 0) {
//comment is a reply
}

Have you completed the interview?
Reply
#3

Okay, cool, I partly got it. This works:

PHP Code:
<?php 
if ($alternate == 1) { //if it's the first box
if ($reply_to) {
$box .= "<div class='reply_box_1'>"; //reply box
} else
if (
$is_admin) {
$box .= "<div class='admin_comment_box_1'>"; //admin box
} else {
$box .= "<div class='comment_box_1'>"; //normal box
}
} else {
//if it's the second box
if ($reply_to) {
$box .= "<div class='reply_box_2'>"; //reply box
} else
if (
$is_admin) {
$box .= "<div class='admin_comment_box_2'>"; //admin box
} else {
$box .= "<div class='comment_box_2'>"; //normal box
}
}

However, one little problem left. Is there also a way I can combine $is_admin and $reply_to, like you could do with css: <div class="reply admin">. So to show the admin box in a reply.
Reply
#4

It's a little complicated:
PHP Code:
<?php
if ($alternate == 1) { //if it's the first box
if ($reply_to && !$is_admin) {
$box .= "<div class='reply_box_1'>"; //reply comment and not admin
} else if ($reply_to && $is_admin) {
$box .= "<div class='reply_admin_box_1'>"; //reply comment and is admin
} else if (!$reply_to && !$is_admin) {
$box .= "<div class='comment_box_1'>"; //normal comment and not admin
} else if (!$reply_to && $is_admin) {
$box .= "<div class='admin_comment_box_1'>"; //normal comment and is admin
}
}
?>

Have you completed the interview?
Reply
#5

(12-Dec-2011, 04:26 PM)Steven Wrote:  It's a little complicated:
PHP Code:
<?php
if ($alternate == 1) { //if it's the first box
if ($reply_to && !$is_admin) {
$box .= "<div class='reply_box_1'>"; //reply comment and not admin
} else if ($reply_to && $is_admin) {
$box .= "<div class='reply_admin_box_1'>"; //reply comment and is admin
} else if (!$reply_to && !$is_admin) {
$box .= "<div class='comment_box_1'>"; //normal comment and not admin
} else if (!$reply_to && $is_admin) {
$box .= "<div class='admin_comment_box_1'>"; //normal comment and is admin
}
}
?>

Thank you very much Big Grin, it works great! I'll post the end result when it's done. I'm sure you won't recognize, at least from the front end, that it's commentics Tongue
Reply
#6

Okay I look forward to seeing it Smile

Post a link in the Showcase when you're ready.

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by sandman
01-Aug-2011, 09:10 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)