-
-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Hardcoded HTML #756
Comments
Wanted to ask in development forum but since the issue is already here and non-staff may want to know it too - to what extent should it be done? For example I'm sure codes like this from inc/functions_user.php need to be moved: $folderlinks .= "<div><a href=\"private.php?fid=$folderinfo[0]\" class=\"usercp_nav_item {$class}\">$folderinfo[1]</a></div>\n"; However, what about all short one-liners? I think such should be moved as they affect the design: $lastpost = "<div style=\"text-align: center;\">-</div>"; but there are also a lot like this (especially in modcp.php): $subject = "<strong>{$lang->ipresult_lastip}</strong> {$profile_link}"; with only one not-so-relevant tag like strong, a or option. Should they be moved too and won't that create too many templates? |
should be change. |
$folderlinks .= "<div><a href=\"private.php?fid=$folderinfo[0]\" class=\"usercp_nav_item {$class}\">$folderinfo[1]</a></div>\n"; This should be moved to a template realistically... $lastpost = "<div style=\"text-align: center;\">-</div>"; To achieve a good looking theme. "Hacks" may be used to get around ugly things like this therefore they should be converted. $subject = "<strong>{$lang->ipresult_lastip}</strong> {$profile_link}"; The Personally since the goal was to remove all hard coded HTML, any HTML that isn't in a template (in the frontend) needs to be moved to a template. |
In the las example there you can use the language system instead. Does $lastpost even needs to be not empty? |
This should also take care of JS files with hardcoded links, which will require more complex fixes. |
That's still hard coded, and something the theme author cannot change easily (i.e. they have to tell the user to change to change it). Therefore that should also be moved to a template. |
Instead of using |
Just to mention here specifically: 'Buddy / Ignore' buttons of Member Profile (in member.php) should be variable driven and that may call 4 additional templates. They are currently coded in a very rigid way ... |
There is also some HTML within the language files. |
I've started to go through the files and removing hardcoded HTML. This commit removes most of the HTML from calendar.php and moves it to templates. |
member.php (profile avatar, website and reputation vote link)
@DEMONATE the buddy code can be easily moved to a single template, not need for four. |
modcp.php part 1 (banning, mod logs and home page)
portal.php (announcement post icon)
search.php (post icon) and showthread (quick reply mod options and similar threads post icon)
@PaulBender don't forget to use the task list created by @ATofighi so you know when you're done. |
reputation.php (adding rep delete button and drop down options)
functions_user.php (PM folders); cached some templates in reputation.php
functions_calendar.php (calendar jump)
modcp.php part 2 (announcements, mod queue, edit user, ip lookup)
functions_forumlist.php (moderators, last post, viewers, unapproved stuff)
usercp.php part 1 (date & time formats, post/threads per page, forum subscriptions and avatar auto resize)
usercp.php part 2 (no buddies/ignored, draft thread/forum links, group leaders)
They could indeed be moved to one template (2 images with src="{$theme['imgdir']}/{$add_remove_buddy}.png" or similar) but it won't be possible after this commit: 3479f64 which hides ignore list button if user is on buddy list and the other way round. So, yes, the buttons are already in separate templates. Also, what will we do about HTML in parser (quotes etc.)? I see that parser file is not included in the list. |
usercp.php part 3 (joinable groups and members of groups)
usercp.php part 4 (home page, post icons)
Changing the parser could be somewhat problematic as we'd have to load several additional templates on most if not all showthread requests. I say it's possibly better to leave the parser be. |
member.php (user star, multi option profile fields, COPPA day dropdown)
Okay, this is done. |
That was quite some work! |
Though all the commits above, I have added 127 templates and removed one (usercp_options_stylebit). |
@PaulBender make sure not to forget to cache templates! I don't have time to check if you did. |
I cached as I went. There shouldn't be any uncached templates. |
Sounds good then :) |
Closing this. Bugs will be reported during Beta 2 testing period. |
https://github.com/mybb/mybb/pull/601/files#diff-3ab6fc25d9d5e6f0a2a9432c19b14717R35 has added HTML to the language file (not the template). Also was #851 removed as well? |
Raise the thread or post approval eval("\$unapproved_posts = \"".$templates->get("forumbit_depth2_forum_unapproved_posts")."\";"); eval("\$unapproved_threads = \"".$templates->get("forumbit_depth2_forum_unapproved_threads")."\";"); or |
@PaulBender http://community.mybb.com/thread-155899.html |
There are 2 more in global.php:
Also, what's up with display: show; in one of the last lines in the same file? Never heard of that value: http://www.w3.org/TR/CSS21/visuren.html#display-prop I can't find where _c is used, so I guess it's used for tbody like _e and thus should be display: table-row-group; |
All hardcoded HTML should be moved to templates.
The text was updated successfully, but these errors were encountered: