Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Req. for code change: sp_SectionStart
Avatar
BOZ
Member
Free Members
sp_UserOfflineSmall Offline
Dec 20, 2011 - 6:27 pm

As I come across bugs I hope to assist in squashing them not just reporting them, to assist this I will use a common format to call attention to the bug as I see it and hopefully offer what I believe is the code fix. This is the first I hope to squash of many to help make this great project as solid as it can be. Most of what I have seen so far as bugs are output of additional or unused div tables or styling elements due to function logic not actually needed output.

 

Request for code change: Function sp_SectionStart

Change reason abstract: Function outputs some code elements that are not used in some circumstances that can confuse some browser rendering engines IE class=' ' when called intentionally with no class. Cleans human readability in source output.

 

Functionality change: No change in use format

Added Functionality: Ability to call div with ID without class, Debug addition using section name

File location: /forum/content/sp-common-view-functions.php

 

Previous code:

Line 129 of function:

# output section starting div
    if(!empty($rowId)) $rowId=" id='$rowId'";
    $out = "<div class='$tagClass$rowClass'$rowId>n";

 

Replace with code:

Line 129 of function:

  # output section starting div
    if(!empty($rowId)){ $tagId = " id='$rowId'"; }else{ if(!empty($tagId)){$tagId = " id='$tagId'";} }
    if(!empty($tagClass)){ $tagClass = " class='" . $tagClass; if(!empty($rowClass)){ $tagClass = $tagClass . $rowClass; } $tagClass .= "'"; }
    $out = "r<div" . $tagId . $tagClass . ">r";
    if($dbug){$out .= "<!-- Begin ". $sectionName . " -->r";}

Avatar
BOZ
Member
Free Members
sp_UserOfflineSmall Offline
Dec 20, 2011 - 6:41 pm

Request for code change: Function sp_SectionEnd

Change reason abstract: Function outputs some code elements that are not used in some circumstances that can confuse some browser rendering engines IE Adds divs at end even when no class or id is given. Cleans human readability in source output.

 

Functionality change: No change in use format

Added Functionality: Debug addition using section name

File location: /forum/content/sp-common-view-functions.php

 

Previous code:

do_action('sph_BeforeSectionEnd_'.$sectionName, $a);

    $out = "<div$tagId$tagClass></div>\n";
    $out.= "</div>\n";

    $out = apply_filters('sph_SectionEnd', $out, $sectionName, $a);

 

Replace with code:

do_action('sph_BeforeSectionEnd_'.$sectionName, $a);

# output section end div
    if(!empty($tagClass)){$tagClass=" class='$tagClass'";}
    if(!empty($tagId)){$tagId=" id='$tagId'";}

    if($tagClass||$tagId){$out = "\r<div" . $tagId . $tagClass . "></div>\r";}
    if($dbug){$out .= "\r<!-- End ". $sectionName . " -->\r";}
    $out.= "</div>\r";

    $out = apply_filters('sph_SectionEnd', $out, $sectionName, $a);

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 20, 2011 - 7:24 pm

ya know... I have written this down at least three times to go back and address those empty divs and keep forgetting...what I get for not opening a ticket...  hate to have fix things up for IE wink but right thing to do...

I am not sure I support adding the debug stuff though...  its already very simple to to without any added code...

add_filter('sph_SectionEnd', 'my_debug_function', 10, 3);
function my_debug_function($out, $name, $a) {
    $out .= "\n<!– End ". $name. " –>\n";
    return $out;
}

and you have same without slowing down core...

will look more closely at your changes and see if we can apply them... thanks!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 20, 2011 - 8:06 pm

I have committed a change to svn that should clean up these endless divs... 

Boz, please svn up and have a look... thanks!

Avatar
BOZ
Member
Free Members
sp_UserOfflineSmall Offline
Dec 20, 2011 - 8:24 pm

Heh the IE was meant as In Example, but yeah fixing for IE is a pain too although I wouldnt do it in functions sorry for the confusion.wink

Mr Papa said

ya know... I have written this down at least three times to go back and address those empty divs and keep forgetting...what I get for not opening a ticket...  hate to have fix things up for IE wink but right thing to do...

I am not sure I support adding the debug stuff though...  its already very simple to to without any added code...

add_filter('sph_SectionEnd', 'my_debug_function', 10, 3);
function my_debug_function($out, $name, $a) {
    $out .= "\n<!– End ". $name. " –>\n";
    return $out;
}

and you have same without slowing down core...

will look more closely at your changes and see if we can apply them... thanks!

 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 20, 2011 - 8:43 pm

no worries. I need to not be so lazy and add stuff to a list I can forget about and open tickets instead! thanks for reminding!

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626