Welcome, Guest. Please login or register.

ShoutBox!

 

Skhilled

2024-08-09, 18:19:29
Awww! Poor thing! LOL
 

Ken

2024-08-09, 09:20:52
 

Skhilled

2024-07-06, 10:33:18
 :D
 

Ken

2024-07-06, 06:40:47
Happy Saturday after the 4th of July!
 :fireworks:
 

Skhilled

2024-07-04, 20:27:02
Happy Day Off From Work!  :D
 

Ken

2024-06-25, 06:23:12
84... who knew?  laughing7
...2013 was my *magic* year
 

Skhilled

2024-06-14, 22:09:12
I hope so! LOL
 

Ken

2024-06-14, 21:41:30
My B-Day is forthcoming and maybe it will be far enough along so that I can be a regular Dancing Fool for that day!!! :banana: :2funny:
 

Ken

2024-06-14, 21:38:38
Happy Friday everyone! I'm  SOOO glad to see Friday and not just because it's the weekend, but because it marks one more day in the recovery of my foot!  laughing7

Scrubmeister

2024-04-19, 10:32:40
Good to see the site back faster than ever. :)

Recent Topics

TP Articles


Search in titles
Search in article texts

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

0 Members and 3 Guests are viewing this topic.

Online Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11937
  • Gender: Male
  • View Gallery
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:
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Skhilled

  • Administrator
  • *
  • Posts: 9423
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • 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 »

Online Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11937
  • Gender: Male
  • View Gallery
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:
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Skhilled

  • Administrator
  • *
  • Posts: 9423
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • 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: 9423
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • 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 »

Online Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11937
  • Gender: Male
  • View Gallery
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
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

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 :)

Online Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11937
  • Gender: Male
  • View Gallery
Re: Welcome Labradoodle-360.
« Reply #8 on: February 01, 2012, 08:05:34 PM »
Great job Matthew.  :bigteeth:
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Labradoodle-360

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

Offline Skhilled

  • Administrator
  • *
  • Posts: 9423
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • 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 :)

Online Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11937
  • Gender: Male
  • View Gallery
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
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.

Offline Skhilled

  • Administrator
  • *
  • Posts: 9423
  • Gender: Male
  • All of my passwords are protected by amnesia...
  • 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.

Online Ken (OP)

  • Vietnam Era Veteran
  • Administrator
  • *
  • Posts: 11937
  • Gender: Male
  • View Gallery
Re: Welcome Labradoodle-360.
« Reply #14 on: February 05, 2012, 01:29:44 PM »
OK, I'll give that a try.  :bigthumb:
"Not all who wander are lost."-Tolkien
Yesterday When I was Young.