DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • August 18, 2018, 01:25:17 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: 1 2 [3]   Go Down
  Print  
Author Topic: Sectioned Chats : File Submission/Discussion  (Read 9958 times)
0 Members and 1 Guest are viewing this topic.
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #30 on: November 12, 2014, 11:06:29 AM »

Being snotty to people who ask for help because they are trying to learn and its hard for them, wont get you anywhere. If you ever need help and keep being snotty to me, it would make me not want to help you. Seriously.

Back on topic. I know how to comment stuff out. I wanted to make sure I was commenting the right thing. So many people have broken their site from trial and error and then didnt know how to fix it. I am not going to be like that.

I also was wondering if there was a way to make the tab highlight when you click it so that the highlight means thats the tab you are on. That way players dont get confused.
Logged

Maverick
Captain of the Guard
***
Offline Offline

Posts: 122


View Profile
« Reply #31 on: November 12, 2014, 12:47:25 PM »

Religion has nothing to do with it, Maverick, so please play nicely.

I mean, at least the majority of my post had some relevance to the topic.  Roll Eyes

Back on topic. I know how to comment stuff out. I wanted to make sure I was commenting the right thing. So many people have broken their site from trial and error and then didnt know how to fix it. I am not going to be like that.

I also was wondering if there was a way to make the tab highlight when you click it so that the highlight means thats the tab you are on. That way players dont get confused.

So many people also have a live site and a test site, for things such as this; testing, debugging, trial and error, etc. Just a thought. Roll Eyes

And if you look at the code of this module, I hope you have done that, already, you will see that if the '$chat' variable is set to 'chat1' it colors or highlights one tab and sets the other to a default color.

I'm looking at this, specifically:

Code:
<?php

if ($chat0 == "chat1"){
$sql db_num_rows(db_query("SELECT commentid FROM ".db_prefix('commentary')." WHERE section = '{$args['section']}-ooc' AND postdate > '$time2'"));
$style1 "style='color:#2E2EFE;'";
if ($sql$style2 "style='color:red;'"; else $style2 "";
} else {
$sql db_num_rows(db_query("SELECT commentid FROM ".db_prefix('commentary')." WHERE section = '{$args['section']}' AND postdate > '$time1'"));
if ($sql$style1 "style='color:red;'"; else $style1 "";
$style2 "style='color:#2E2EFE;'";
}

?>


For a little more personal touch, you can look here for further information regarding HTML colors: http://www.w3schools.com/html/html_colors.asp
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1883


You're welcome.


View Profile WWW
« Reply #32 on: November 12, 2014, 12:50:55 PM »

Being snotty to people who ask for help because they are trying to learn and its hard for them, wont get you anywhere. If you ever need help and keep being snotty to me, it would make me not want to help you. Seriously.

Back on topic. I know how to comment stuff out. I wanted to make sure I was commenting the right thing. So many people have broken their site from trial and error and then didnt know how to fix it. I am not going to be like that.

I also was wondering if there was a way to make the tab highlight when you click it so that the highlight means thats the tab you are on. That way players dont get confused.

That's what development servers are for. Cheesy To test every module that you're going to use on your live site. That way, if you screw something up, it's not "Oops, there goes my live site!", it's "Oops, there goes my dev site, my live site is fine!", and you can fix whatever on your dev site.

The tab that a player is currently on does get highlighted (well, changed colour).

Edit: Basically, what Maverick said. xD
Logged

Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #33 on: November 13, 2014, 01:50:05 PM »

I changed the color of the tabs and when I did that I didnt put them in the same order the old ones were in. When Maverick made that post I saw what I did wrong and fixed it. Everything is good now. Thank you all for your help.
« Last Edit: November 25, 2014, 09:07:03 AM by Megan|SaraBeth » Logged

Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #34 on: April 08, 2015, 02:50:04 PM »

I tried pasting part of the code in the file in the commentary file above the textarea so that the tabs are above the chat box. All that did was put [][] there. Is there any way to put it above the chat box and not above the chat? Help would be greatly appreciated.
Logged

Aeolus
Mod God
*****
Offline Offline

Posts: 1883


You're welcome.


View Profile WWW
« Reply #35 on: April 08, 2015, 06:52:18 PM »

I tried pasting part of the code in the file in the commentary file above the textarea so that the tabs are above the chat box. All that did was put [][] there. Is there any way to put it above the chat box and not above the chat? Help would be greatly appreciated.

Again with the copy-pasting, no surprise.

Yes, there is a way - change the hook to one above the chatbox.
Logged

Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #36 on: April 08, 2015, 07:06:02 PM »

I figured it was that but I dont know a list of hooks off the top of my head. I'd look it up on the DragonPedia but that thing has been broken for like 3 or 4 years.


EDIT: I replaced the village hook with the insertcomment hook and it did the same thing. It turned the split chat off and only put [][] above the chat box.
« Last Edit: April 08, 2015, 07:24:30 PM by Megan|SaraBeth » Logged

Sunday
Codemeister
****
Offline Offline

Posts: 396


So meme'd up.


View Profile
« Reply #37 on: April 08, 2015, 08:10:45 PM »

I replaced the village hook with the insertcomment hook and it did the same thing. It turned the split chat off and only put [][] above the chat box.
I am going to teach you how to analyze the situation of the error. First you need to check what area is having the issue. You say it only shows displays the following
Quote
[][]

So, we need to find this section in the code which is on line 77 - pending that you did not change anything else in the module:
Code:
<?php
rawoutput("<center><big><b>[<a href='$link1$style1>{$chatnames[$h]['chat1']}</a>] [<a href='$link2$style2>{$chatnames[$h]['chat2']}</a>]</b></big></center><br />");

So, we can see that those links specifically are not showing. Let's focus on the following...
Code:
<?php
<a href='$link1' $style1>{$chatnames[$h]['chat1']}</a>

If you were to inspect the html source, you can analyze the section and see that the anchor (<a href=''></a>) is just fine. So the issue may be in the anchor's text:
Code:
<?php
{$chatnames[$h]['chat1']}

This, is $chatnames an array which is defined just a few lines above the output at line 70. This is where we must look first.
Code:
<?php
$chatnames = array(
"v" => array("chat1" => "Roleplay""chat2" => "OOC"),
"s" => array("chat1" => "Business""chat2" => "General")
);

At a glance, this looks fine - no errors are made, the array is structured properly, and as a bonus, it is easily readable. So the answer must lie further in the anchor's text. On to [$h] - let's see what is there, defined on line 44:
Code:
<?php
$h $hookname[0];

There is the issue, clearly laid out. Since you do not know, $h is set to the $hookname's first letter 0 I can tell this simply because the $hookname is a string and 0 refers to the first entity that we occur. So the issue is we are looking for the first letters ([ i ]nsertcomment, [ s ]uperusertop) inside of the $chatnames array. So let's go back a bit. We know our first letters being grabbed are i and s, since they are for two hooks.

Code:
<?php
$chatnames = array(
"v" => array("chat1" => "Roleplay""chat2" => "OOC"),
"s" => array("chat1" => "Business""chat2" => "General")
);

Ah, there it be! See, we switched the hooks from village, which would have set the $h to v for [v]illage, and $chatnames still has a declaration for v! We have no declaration for i as in [ i ]nsertcomment! Just change the $chatnames array to the following:
Code:
<?php
$chatnames = array(
"i" => array("chat1" => "Roleplay""chat2" => "OOC"),
"s" => array("chat1" => "Business""chat2" => "General")
);

That will fix the entire module as you want it. If you just copy and paste this answer without properly giving the entire post a look over to see if you can debug some on your own in the future... Then that is a shame on you.

Have a nice day.
« Last Edit: April 08, 2015, 08:13:48 PM by Stephen.Kise » Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #38 on: April 08, 2015, 08:18:51 PM »

See...I didnt know thats what that [ 0 ] did at the end of hookname. I am still learning and posts like yours help me. Its hard for me to get coding. Its why I never advanced my html past basic and google everything about it. But a lot of the php sites on google arent specific to lotgd style so its hard to understand it and it just ends up confusing me over all. Thank you for explaining it to me so I can understand and learn. I appreciate it hugely.

EDIT: I changed the places I needed to change and when it worked, I clicked on each tab individually and only was displayed the Roleplay chat in both tabs. The OOC chat was gone.

EDIT 2: I believe it has something to do with this core edit:

$texts = modulehook("village",$texts);
//special hook for all villages... saves queries...
$texts = modulehook("village-{$session['user']['location']}",$texts);

I havent tried to fix it on my own cause I dont know what other modules or files use that part of the village.php file. Help on this one would be greatly appreciated.
« Last Edit: April 08, 2015, 09:05:32 PM by Megan|SaraBeth » Logged

Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #39 on: April 09, 2015, 11:48:26 PM »

So I added module_addhook_priority("insertcomment",25); to the top with the other addhooks and kept the village one and the case "village": and changed case "superusertop": to case "insertcomment": since I didnt want it in the grotto anyway. I then changed the v in the $chatnames array to an i. The only error there is now is the [ ] [ ] still appear at the top of the chat due to the village hook. They are at the bottom above the chat box with the words Roleplay and OOC inside them. Just I cant get the blank [ ] [ ]  to disappear at the top of the chat or the [Roleplay] [OOC] to center in the insercomment case for the life of me. The centering not happening it probably due to some of the rawoutput code pulling into the village hook. I dont need the village hook for anything other than the chats appearing correctly. Stopping the village hook from pulling any of the rawoutput code would be nice. Help would be appreciated.


EDIT: My staff and I figured it out. We just copied the whole superusertop case that we changed to be the insertcomment case into the village case and then blocked the addnavs and rawoutput. That took away the [ ] [ ] above the chat. Then we went to the rawoutput code in the insertcomment case and added the &nbsp; code before the <center> code and that allowed it to be centered.

Sometimes 2 heads are better than 1.
« Last Edit: April 10, 2015, 10:47:01 AM by Megan|SaraBeth » Logged

Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 1053



View Profile WWW
« Reply #40 on: April 11, 2015, 11:22:40 PM »

Now I have come across another problem. The case "insertcomment": wont read my code to place it into one village only.

This is the code.

Code:
$place = get_module_setting('place');
$hook = get_module_setting('hook');
if (get_module_setting('hook')==0||get_module_setting('place')==$session['user']['location']&&get_module_setting('hook')==1) {

So now the links are in all the chat places. Is there a fix?

This is where I placed the code in the file.

Code:
$place = get_module_setting('place');
$hook = get_module_setting('hook');
if (get_module_setting('hook')==0||get_module_setting('place')==$session['user']['location']&&get_module_setting('hook')==1) {
$chatnames = array(
"i" => array("chat1" => "Roleplay", "chat2" => "OOC"),
"s" => array("chat1" => "Business", "chat2" => "General")
);
$chatnames = translate_inline($chatnames);

output_notl("`0`n");
rawoutput("&nbsp;<center><big><b>[<a href='$link1' $style1>{$chatnames[$h]['chat1']}</a>] [<a

href='$link2' $style2>{$chatnames[$h]['chat2']}</a>]</b></big></center><br />");


if ($chat0 == "chat2") $chatao = "-ooc"; else $chatao = "";
$args['section'] .= $chatao;
                                                      }
« Last Edit: April 11, 2015, 11:24:28 PM by Megan|SaraBeth » Logged

Lila Dominuss
Member

Offline Offline

Posts: 1



View Profile WWW
« Reply #41 on: July 23, 2018, 10:52:21 PM »

This discussion helped me, had my sectioned chats working in a few minutes and relatively easy to do. Thank you Aelous!
Logged

Aeolus
Mod God
*****
Offline Offline

Posts: 1883


You're welcome.


View Profile WWW
« Reply #42 on: July 24, 2018, 02:35:41 AM »

This discussion helped me, had my sectioned chats working in a few minutes and relatively easy to do. Thank you Aelous!

No problems, glad to be of service Lila Doimnuss!
Logged

Pages: 1 2 [3]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
32 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search