One annoyance of mine is when Aiki outputs code when I don't want it
to do. I wish aiki were actually silent by default, but that is
another matter if I can shut it up completely.

In getting a test site going, I came across the code spaghetti of
libs/widgets.php and tried to take out some default output here in rev
1051 on line 205 I tried to add some statement to only output comments
into the html stream if actually in debug mode. Right, why would we
need to send more data then we need to on a live site?:

                if ( isset($config["debug"]) and $config["debug"] ) {
                    $this->widget_html .=
                    "\n <!--start {$widget->widget_name}({$widget->id})--> \n";
                }

And, again on line 251:

                if ( (isset($config["debug"]) and $config["debug"]) ) {
                    $this->widget_html .=
                       "\n <!--{$widget->widget_name}({$widget->id}) end--> \n";
                }


Then I realized after reviewing the code, that the widgets code relies
upon the comments in the code to deal with kill widgets!!!!

line 258 of libs/widgets.php

            if ($this->kill_widget) {
                if ($widget->if_no_results) {
                    $dead_widget =
                        '<'.$widget->widget_type.' id="'.
                        $widget->widget_name.'">' . $this->parse_no_results($wid
get->if_no_results) .
                        '</'.$widget->widget_type.'>';
                } else {
                    $dead_widget = "";
                }
                /**
                 * @todo looks like some text is placed into the output
                 *       stream and then replaced here!!! Nooo!
                 */
                $subpattern="[A-z0-9\-_]*\({$this->kill_widget}\)";
                $this->widget_html =
                        preg_replace("/<!--start {$subpattern}-->(.*)<!--{$subpa
ttern} end-->/s",
                                       $dead_widget, $this->widget_html, 1, $cou
nt);
                $this->kill_widget = '';

            }

###

Does anyone else think this is bad? How can we get rid of this comment
output and keep functionality? The above is a hack in my opinion.

widgets.php needs a teardown. I'm thinking down to the sql and then a rebuild.

Jon

-- 
Jon Phillips 王✳爻气 http://fabricatorz.com ✳ skype: kidproto ✳ irc: rejon
+1.415.830.3884 (global) ✳ +86-187-1003-9974 (beijing)

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to