Welcome, Guest. Please login or register.

ShoutBox!

 

Ken

2019 Nov 12 12:06:01
hahahaha! yes, it is Tuesday, but only for a little while.  ;)
 

Skhilled

2019 Nov 12 10:32:00
Now it's Tuesday. LOL
 

Skhilled

2019 Nov 02 22:30:55
Nope, it's Saturday.
 

Ken

2019 Oct 18 21:08:00
Yepp... it r Friday!  :thumbup:
 

Skhilled

2019 Oct 04 18:59:21
Now it is :)
 

Ken

2019 Oct 04 12:10:09
Is it Friday yet???  :o
 

Skhilled

2019 Aug 19 08:08:59
Me been too busy. LOL
 

Ken

2019 Aug 16 11:02:54
TGIF!  :disturbed:

Actually, I don't really care anymore.  laughing7
 

Ken

2019 Aug 11 08:02:18
It's a nice Sunday morning here in T-Ville!  :thumbup:
 

Ken

2019 Jul 25 14:02:41
hahahaha

Recent Topics

Author Topic: Welcome Labradoodle-360.  (Read 3484 times)

0 Members and 1 Guest are viewing this topic.

Offline Ken (OP)

Welcome Labradoodle-360.
« on: January 25, 2012, 02:43:12 PM »
Lets send out a big Welcome Aboard to our newest member Labradoodle-360! 

Lab is on the SMF 'Customizer' team and works with some of the Modification Packages as well and has graciously offered to help with the 'Childboards as Dropdown' Mod here on the FamilyForum... I installed the Mod, but have had no success with getting it to work correctly. When a board is selected in the drop-down window  nothing happens.


Labradoodle is the coder(writes the code) for the Mod, so me thinks he'll likely get it sorted.

Welcome to Our FamilyForum Labradoodle-360.  :2thumbs:
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • *
  • Posts: 5803
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
Re: Welcome Labradoodle-360.
« Reply #1 on: January 28, 2012, 03:13:50 AM »
Welcome aboard, Labradoodle-360. :)

EDIT: I've tried to install it on my site and can see the dropdown but when you choose one it does not switch to it. also in the dropdown listing at the top are a blank space and " : ".  :yikes:
« Last Edit: January 28, 2012, 03:21:20 AM by Skhilled »

Offline Ken (OP)

Re: Welcome Labradoodle-360.
« Reply #2 on: January 28, 2012, 09:10:54 AM »
Welcome aboard, Labradoodle-360. :)

EDIT: I've tried to install it on my site and can see the dropdown but when you choose one it does not switch to it. also in the dropdown listing at the top are a blank space and " : ".  :yikes:

That's pretty much the same behavior as we're having here on the FF.
Lab is working on it I think, we'll just have to wait until he sorts it out.  :bigthumb:
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • *
  • Posts: 5803
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
Re: Welcome Labradoodle-360.
« Reply #3 on: January 28, 2012, 01:45:38 PM »
If it works I'd use it. :)

Offline Skhilled

  • Administrator
  • *
  • Posts: 5803
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
Re: Welcome Labradoodle-360.
« Reply #4 on: February 01, 2012, 08:33:57 AM »
Update!

I had a little extra time on my hands and decided to see if I could get this to work. Keep in mind that I'm no coder but here's what I've found:

1.  Many of the files in the zip do not have a closing php tag.

2.  The file, cad_db_install.php has an error...I think in the following:
Code: [Select]
// Our variables & values.
$final_array = array(
'lab360_childboard_dropdown' => 1,
'lab360_childboard_limit' => '0'
);

Notice that line 23 has no single quotes around the 1 and line 24 has quotes around the 0. Both should be the same I would think...

3.  cad_db_uninstall.php does not remove the tables from the db. I think, but could be wrong, that there is a missing underscore in this line:
Code: [Select]
DELETE FROM {db_prefix}settings
I'm thinking it should be: DELETE FROM {db_prefix}_settings.

Can't see anything else just yet...

Offline Labradoodle-360

Re: Welcome Labradoodle-360.
« Reply #5 on: February 01, 2012, 01:51:10 PM »
Whoops! Thanks for the welcomes, guys! It'd be easier for me to fix this, if I could duplicate it myself, but I've not been able to yet.

Quote from: Skhilled
1.  Many of the files in the zip do not have a closing php tag.
None of my PHP files have closing tags, unless strictly required. And there is absolutely nothing wrong with this, it's actually safer and a better practice.

Zend Framework: PHP File Formatting - "For files that contain only PHP code, the closing tag ("?>") is never permitted. It is not required by PHP, and omitting it? prevents the accidental injection of trailing white space into the response.".

Quote from: Skhilled
2.  The file, cad_db_install.php has an error...I think in the following:
Code: [Select]
// Our variables & values.
$final_array = array(
'lab360_childboard_dropdown' => 1,
'lab360_childboard_limit' => '0'
);
Notice that line 23 has no single quotes around the 1 and line 24 has quotes around the 0. Both should be the same I would think...
No, let me explain...quoting an attribute (whether single-quotes or double-quotes) makes that value a STRING. Unquoted values are assumed to be integers. For instance... $variable = 1; is an integer. $variable = '1'; is a string. Even though they'll output identically, they are different TYPES of data.

Here's a little bit of reasoning as to why in this case, specifically, one is cast as a string, and one as an integer. These fields are added to {db_prefix}settings, which are all thrown into the $modSettings array, the settings table has two columns, variable and value. Both of which are expecting strings, so even if you send an integer, it'll be cast to the database as a string.

However, assigning the INTEGER 0 to a variable can also be seen as 'null' or would return !empty as false (empty) because 0 is another way of saying nothing. But the variable HAS to enter the database as 0, and since it's going to be a string anyways, it's cast as a string in the definition of the variable in the array so it's cast, otherwise it'll be considered empty, and not be set in the database properly. Quoting the 0 makes the zero a string, and as long as the string has a character, it's not considered empty. Empty only checks for 0 being an integer, so it HAS to be a string in this scenario to get the proper value sent to the database.

Since 1 is not empty, it's fine to stay an integer, it'll be cast later, but it's still okay to be an integer ahead of the value being cast to the database. Although it could be cast as a string, it simply doesn't matter as it doesn't affect the outcome.

Quote from: Skhilled
3.  cad_db_uninstall.php does not remove the tables from the db. I think, but could be wrong, that there is a missing underscore in this line:
Code: [Select]
DELETE FROM {db_prefix}settingsI'm thinking it should be: DELETE FROM {db_prefix}_settings.
To make this clear, there are no tables added by my modification, nor are there even columns added, simply just rows are added. Have you tried uninstalling? It should indeed remove the rows. I didn't encounter any issues and the syntax is most definitely accurate, although it could indeed be minimized by using IN(); rather than utilizing a foreach(); loop, but again, that's not a problem, just a possibility to increase the performance - which would not even be noticed.

Let me explain this to you.  What is {db_prefix}?  It's simply a "keyword" or a "shortcut" that will be replaced with the ACTUAL database prefix upon the query being executed. How? using a str_replace();.

Here's how SMF does it specifically:
Code: [Select]
global $smcFunc, $db_prefix;

$tableName = str_replace('{db_prefix}', $db_prefix, $tableName);
What is this doing? Well, it's globalizing the actual database prefix, so it can be used ($db_prefix is the variable). The variable is defined in Settings.php.

Assuming you don't customize the prefix, it's "smf_" so {db_prefix} = $db_prefix = "smf_".  So when you take that further, {db_prefix}settings would be smf_settings or yourprefix__settings or yourprefix_settings, or whatever your prefix is. The underscore is PART of the prefix.  The default prefix, once again, is smf_, meaning {db_prefix}_settings would normally output smf__settings, which is incorrect.

So all of the issues in question are inaccurate, and not actual issues, more misunderstanding PHP syntax, data types, and SMF procedures.

Which is fine, I completely understand, and I'm sorry if this comes across as rude or insulting, neither of which are my intentions of this post. I simply wanted to help you understand why they are NOT issues, otherwise I wouldn't have spent 20 minutes writing this in the first place.

Also, if there are any steps to replicate the issues you guys are experiencing, I'd be extremely grateful if you could pass them on so I could replicate and fix the existing issues.

Thank you for your time and interest in helping!

Best Regards,
Matthew "Labradoodle-360" Kerle
SMF Customizer
« Last Edit: February 01, 2012, 02:01:53 PM by Labradoodle-360 »

Offline Ken (OP)

Re: Welcome Labradoodle-360.
« Reply #6 on: February 01, 2012, 03:55:02 PM »
Thanks for that explanation Matthew.  :bigthumb:

Like Steve, my experience and understanding of coding practices and 'rules' is very limited and your post helps me gain some more of that understanding. 
The only contribution that I'm able to make to the discussion is to describe the behavior when the Mod is installed and enabled. 
I've turned it back on so that we can see the errors that it's throwing, as seen in the box below.

Code: [Select]
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_go

File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 287

Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664

http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum

8: Undefined index: lab360_board_children
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 279

Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_select_child
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 278
Apply Filter: Only show the error messages of this member Ken
Apply Filter: Only show the error messages of this IP address 173.189.218.247 
  Reverse chronological order of list Today at 03:49:33 PM
Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_go
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 287
Apply Filter: Only show the error messages of this member Ken
Apply Filter: Only show the error messages of this IP address 173.189.218.247 
  Reverse chronological order of list Today at 03:49:33 PM
Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_board_children
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 279
Apply Filter: Only show the error messages of this member Ken
Apply Filter: Only show the error messages of this IP address 173.189.218.247 
  Reverse chronological order of list Today at 03:49:33 PM
Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_select_child
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 278
Apply Filter: Only show the error messages of this member Ken
Apply Filter: Only show the error messages of this IP address 173.189.218.247 
  Reverse chronological order of list Today at 03:49:33 PM
Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_go
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 287
Apply Filter: Only show the error messages of this member Ken
Apply Filter: Only show the error messages of this IP address 173.189.218.247 
  Reverse chronological order of list Today at 03:49:33 PM
Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_board_children
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 279
Apply Filter: Only show the error messages of this member Ken
Apply Filter: Only show the error messages of this IP address 173.189.218.247 
  Reverse chronological order of list Today at 03:49:33 PM
Apply Filter: Only show the error messages of this session d130d53c65092989836b237aba472664
Apply Filter: Only show the errors of this type Type of error: Undefined
Apply Filter: Only show the error messages of this URL
http://www.ourfamilyforum.org/FamilyForum/index.php?action=forum
Apply Filter: Only show the errors with the same message
8: Undefined index: lab360_select_child
Apply Filter: Only show the errors from this file
File: /home/kenkayjm/public_html/FamilyForum/Themes/default/languages/Post.english.php (main sub template - eval?)
Line: 278
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Labradoodle-360

Re: Welcome Labradoodle-360.
« Reply #7 on: February 01, 2012, 06:24:52 PM »
I fixed it for you...the issue was extremely simple, and not an issue with the modification itself. My modification conflicts with portals, due to portals adding ?action=forum. The code I add to ./Sources/Load.php ONLY executes on BoardIndex (if action is empty, and topic is empty) which changes if Portals are used, because the "BoardIndex" becomes ?action=forum.

Here's the fix.
./Sources/Load.php
Find my block of code (Search for "Labradoodle-360) and replace it with this:
Code: (This) [Select]
//-- Labradoodle-360; Childboards as Dropdown
if ((empty($context['current_action']) || !empty($context['current_action']) && $context['current_action'] == 'forum') && empty($_GET['topic']))
{
require_once($sourcedir . '/cad_source/main.php');
loadChildboards_as_Dropdown();
}
// End Labradoodle-360; Childboards as Dropdown --//
I'll release an official patch soon that adds Portal compatibility. You guys are the first ones to have it working with a portal :)

Offline Ken (OP)

Re: Welcome Labradoodle-360.
« Reply #8 on: February 01, 2012, 08:05:34 PM »
Great job Matthew.  :bigteeth:
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Labradoodle-360

Re: Welcome Labradoodle-360.
« Reply #9 on: February 01, 2012, 09:39:21 PM »
Thanks...enjoy! :)

Offline Skhilled

  • Administrator
  • *
  • Posts: 5803
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
Re: Welcome Labradoodle-360.
« Reply #10 on: February 02, 2012, 08:22:24 AM »
Ah! I get it. Thank you for clearing it up! Like i said I'm no coder but do understand a little bit. I really need to learn more and what you've posted did teach me quite a bit. Thanks. :)

I was unaware that the closing tag was unnecessary. I'm am old-school BASIC and dBase programmer and it's been quite a few years since I've done any programming. LOL I'm used to everything having closed tags, even in PHP.

 I do understand the basics of variables and arrays so what you've said makes sense. And I wasn't sure if {db_prefix} actually included the underscore or not. I had an idea that it did but thought I'd mention it anyways just in case. LOL

I always say that when you stop learning you stop living. I'm glad I've learned a few new things now.  :08:

EDIT: And yes, it works on my site too. :) I've updated modifications.xml with the new code in case I have to uninstall it and reinstall it again...at least until the new update comes out.  riteon
« Last Edit: February 02, 2012, 08:32:28 AM by Skhilled »

Offline Labradoodle-360

Re: Welcome Labradoodle-360.
« Reply #11 on: February 04, 2012, 04:25:29 PM »
Andd the new update is out. Thanks all :)

Offline Ken (OP)

Re: Welcome Labradoodle-360.
« Reply #12 on: February 04, 2012, 04:27:54 PM »
Andd the new update is out. Thanks all :)

It is we who thank you.  :2thumbs:

I'm going to go ahead and install the package even though it works OK with your edits to the FF files.

EDIT: Or... maybe not.  :opps:
The package manager throws an error if an attempt is made to uninstall the old package.
Quote
Replace    ./Sources/Load.php    Test failed
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • *
  • Posts: 5803
  • Gender: Male
  • Once you stop trying to learn, you stop living!
  • View Gallery
    • Buildz Hosting
Re: Welcome Labradoodle-360.
« Reply #13 on: February 05, 2012, 10:34:17 AM »
Andd the new update is out. Thanks all :)

It is we who thank you.  :2thumbs:

Ditto! :)

I'm going to go ahead and install the package even though it works OK with your edits to the FF files.

EDIT: Or... maybe not.  :opps:
The package manager throws an error if an attempt is made to uninstall the old package.
Quote
Replace    ./Sources/Load.php    Test failed


That's because you edited that file with code that is not from the original mod. you'll have to manually remove the edited code:
Code: [Select]
//-- Labradoodle-360; Childboards as Dropdown
if ((empty($context['current_action']) || !empty($context['current_action']) && $context['current_action'] == 'forum') && empty($_GET['topic']))
{
require_once($sourcedir . '/cad_source/main.php');
loadChildboards_as_Dropdown();
}
// End Labradoodle-360; Childboards as Dropdown --//

 and replace it with the original code:
Code: [Select]
//-- Labradoodle-360; Childboards as Dropdown
if (empty($_GET['action']) && empty($_GET['topic']))
{
require_once($sourcedir . '/cad_source/main.php');
loadChildboards_as_Dropdown();
}
// End Labradoodle-360; Childboards as Dropdown --//

OR: Just uninstall it and remove that bit of code altogether then reinstall with the new mod.

Offline Ken (OP)

Re: Welcome Labradoodle-360.
« Reply #14 on: February 05, 2012, 01:29:44 PM »
OK, I'll give that a try.  :bigthumb:
" If everything seems under control, you’re not going fast enough." - Mario Andretti