Loading...
 
Themes

Themes


Moving the comments box on wiki pages

Hello
I'd like to move the comments box from the bottom of each wiki page to the right side, allowing users to see it as they scroll down in the page.

I've found the comment-container div class in the tiki_base.css. Ideally, I'd like to define and use a class specific to wiki page comments, so if I ever decide to use comments on articles or blogs, I could.

I'm not quite sure how to re-define the comments box so it floats right of the article, and if I define a new css class, I would need to change where the new class would be in wiki pages. That is to say, I know I need t copy the entire comments-container class and adjust the name to create a unique value, but I'm not sure of the css that will move the box from the bottom to the right. Also, I cant' seem to find where the comments-container is called in the .tpl files for wiki pages, so I can call the new "comments-container-wiki" class.

Thanks!

Jennifer

Tikiwiki 14

Hi Jennifer,

imho the comment box is defined in a template (would have to find out which one).

This snippet would have to go into another template or in a custom module.

Are you aware of used to working with HTML/Smarty templates?

Regards,
Torsten

Um, yeah, to a point. HTML more then smarty, but I can figure most any of it out with some trial-and-error and some guidance of where to look.

I'll check. Interesting for me aswell, as I am tinkering with templates myself these times.

T.


Okay, I've figured out if I could adjust the line in the templates/layouts/basic/layout_view.tpl to read "if zone_is_empty ('right') and category id = 2 (the only category that should have comments), then set the columns the same as the one where neither right nor left are empty, it creates a space for the comments to be in.

However, the category ({if $categId eq '2'}) doesn't seem to be working and I can't figure out where the comments are being called.


Hi Jennifer,

try this for the categories
(inalienable source: https://themes.tiki.org/Template+Tricks):

{if isset($objectCategoryIds) and in_array(257, $objectCategoryIds)}
 show this
{/if}


Comments:

I found the templates to create the display here: templates/comment
BUT I aswell do not find, where the comments are called to the wikipage - including the identification between comment post/edit/display and the wobject Id of the page.

Maybe you write an eMail to the dev-list? I am sure there are a few devs knowing the place or how/where to find.

Regards
Torsten

That didn't hurt it, but it didn't exactly work either. I added a second line of {if $categId='2'} and it did nothing.

I think I will. They've pointed me in the right directions before when it came to where to add an if statement.

I found that comments .tpl as well, but yeah, it's just how the comments behave once they are called by the content block, not that they are called.

I guess we have to ask Jonny, Jean-Marc and the lads, where we find the code of the content bock.

errrr ... maybe this is actually just in ph? => then to find in the root or somewhere in the lib ...

Regards


Okay, so using what you showed me, I found the article which explained how to use it (https://themes.tiki.org/tiki-index.php?page=Template%20Tricks&pagenum=4) and I have just the pages in the specific category behaving correctly in as a layout. I even managed to hide the would-be comments from anonymous users.

  • I had to do an if statement above of the "div class = row row-middle" portion, where I copied the column structure from the "if right nor left is empty", replacing the {modulelist zone=right} with a "comments go here" placeholder. I had to do a complete div class, followed by an else statement and the div class as it was defined in the original.


Now if I can just figure out where the comments are being called from.

Thanks for your help. You made two great suggestions (look at the .tpl's and use the category limiter) that pointed me in the right direction!


Had to jump back on one more time to inform you I accomplished it.
By using the "Smart Template Usage Indicator" (https://themes.tiki.org/tiki-index.php?page=Template%20Tricks&pagenum=3), I was able to find which .tpl file the comments container was being called from (tiki-page_bar.tpl) and move the if statement from one .tpl to the other.

Thanks again. You pointed me in the absolute right direction and I was able to use the resources and figure it out. I would have never found what I was looking for without your help, Torsten!


Japan

Hi,

If you want to experiment with a CSS-only approach to this, you could add this to your site's custom CSS rules on the Look & Feel admin page:

div#page-data {
     width: 68%; 
}

div#comment-container {
     position:absolute;
     top: 35%;
     left: 70%;
     background: white;
     border: 1px solid black; 
     padding: 10px;
     overflow-x: scroll;
}

#comment-container .edit-zone {
     min-width: 300px;
}


The values are just suggestions based on a quick experiment and would likely need adjusting at least for colors. The idea is to limit the width of the wiki page content and position the comments to the right of that. (Only div#col1 - the main column of the page - is used.) I added the minimum width and horizontal scroll in the comments div because when the replies start nesting a few layers deep, the indenting causes the available room to narrow quite a bit, so the min-width ensures a reasonable width for the comment edit form toolbar, etc.

The downside of this is that the wiki content is narrower than normal, and narrower on every page whether the page has comments or not. The upside is that it's an easy and simple modification and no templates are changed, so there's no risk of having customizations overwritten in a Tiki upgrade.

-- Gary