cb_login without spaghetti-code

14 years 10 months ago #101916 by klopsknoedel
cb_login without spaghetti-code was created by klopsknoedel
hi,

As the subject explains i want to know if it is possible to write the code of the cb_login module WITHOUT spaghetti-code.
I'm using www.qualidator.com to see if my site is high-quality coded or not. On the look-up i've recognised that i got the error of using spaghetti-code.
These code was generated by the cb_login module and i started rewriting it.
This code is attachet to this thread (but not finished).
The CSS-File has to be included in your template-index.php.
I've only tested it in flat-view and the avatar-image is ALWAYS on the left site (if you choose to show the avatar-image).

I want to know if it is possible to avoid spaghetti-code in the future because it is no big deal to extract "style"-tags into an extra CSS-File!

An other problem is that the "width"- and "height"-tags for the images on line 654 and 659 are not valid. In this code:
[code:1]
$txtusername = '<label for="mod_login_username'.$class_sfx.'">'
. ( $show_username_pass_icons >= 1 ? '<img src="' . $urlImgPath . 'username.png" class="image_1" alt="' . $userNameText . '" /> ' : '' )
. ( $show_username_pass_icons <= 1 ? $userNameText : '' )
. '</label>'
;
$txtpassword = '<label for="mod_login_password'.$class_sfx.'">'
. ( $show_username_pass_icons >= 1 ? '<img src="' . $urlImgPath . 'password.png" class="image_1" alt="' . _UE_PASS . '" /> ' : '' )
. ( $show_username_pass_icons <= 1 ? _UE_PASS : '' )
. '</label>'
;
[/code:1]

I will be very happy if this will be fixed in the future releases. I love the CommunityBuilder and it's power but i miss valid code.
Otherwise you guys do a great job!

Sorry for my bad english! :whistle:

Greats
Sascha Hofmann

Attachment cb_login_nospaghetti.zip not found



Post edited by: klopsknoedel, at: 2009/06/13 14:23
Attachments:

Please Log in to join the conversation.

14 years 10 months ago #102001 by beat
Replied by beat on topic Re:cb_login without spaghetti-code
- Very interesting tool indeed, bookmarked it. Although I'm not sure if everything can be automated, I like automation :)

- CB Login module is indeed marked for rewrite, and probably the least representatitive piece of code from CB... anyone volounteering for a good rewrite ?

- I removed the "px" suffix from those 2 images, so that it validates.

- Thanks for your contribution of the "nospagheti" module, with styles replaced by classes, and a table by a div.

There was a number of valid reasons that cb login module was made that way, most, which are not valid anymore, so it's time for a rewrite...when time permits....anyone volounteering for a good rewrite ?

Here were the reasons for those design choices (well, more constraints than free choices at design time...):

- joomla 1.0 modules can't add stylesheets to the header, as they are executed "too late" in the templates. <style> declarations break rendering, so only left variant was style tags. Joomla 1.5 doesn't have those limits, so we can now do better.

- joomla 1.0 templates have specific CSS for the joomla 1.0 login module, so we followed same "spaghetti-markup" with the unneeded table to lower any template incompatibility. Here too, Joomla 1.5 provides improvements.

Finally, CB login module has outgrown its initial structure, and should be rewritten, so it goes better too.

Thanks in this first step towards a better CB Login module B)

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

14 years 10 months ago #102020 by klopsknoedel
Replied by klopsknoedel on topic Re:cb_login without spaghetti-code
hi,

that's a great thing that you thing about rewriting the cb_login module. I just have to say that i deleted the possibilty to choose the avatar-position. So it now doesn't matter which position you choose (if "left" or "right") ... i don't know how to implement it in a valid way so i think you'll know better ;)

If you don't have any time to redesign (or rewrite) the module in the future i can build a dummy which you only have to make it fit in the functions it should have.

It's a great thing that you realy thing about rewriting 'cause of my post (maybe earlier) ;)

...

Would it be a big deal to switch between two css-files (avatar_left.css and avatar_right.css) if one of those are choosen in the backend? Just an idea! :)

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 1.786 seconds

Facebook Twitter LinkedIn