Remove Hardcoded HTML #756

Closed
PaulBender opened this Issue Jun 16, 2014 · 28 comments

Comments

Projects
None yet
10 participants
@PaulBender
Member

PaulBender commented Jun 16, 2014

All hardcoded HTML should be moved to templates.

@PaulBender PaulBender added this to the 1.8 Beta 2 milestone Jun 16, 2014

@Destroy666x

This comment has been minimized.

Show comment
Hide comment
@Destroy666x

Destroy666x Jun 16, 2014

Contributor

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?

Contributor

Destroy666x commented Jun 16, 2014

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?

@ATofighi

This comment has been minimized.

Show comment
Hide comment
@ATofighi

ATofighi Jun 16, 2014

Contributor
  • calendar.php: lines 413, 417, 421, 425, 429, 433, 444, 448, 452, 456, 460, 464, 500, 504, 1009, 1013, 1017, 1021, 1025, 1029, 1040, 1044, 1048, 1052, 1056, 1060, ...
  • editpost.php line: 790
  • forumdisplay.php lines: 240, 1240
  • global.php lines: 295, 299, 670, 688, 692, 715, 754
  • inc/functions.php lines: 1736, 1741, 1747, 2948, 2959, 2967, 3119, 3129, 3138, 3148, 3151, 3274, 3277, 3292, 3312, 3316, 3320, 3518, 3532, 4373, 4444, 4445, 4454, 4455, 4456, 4509, 4525, 4528, 5239, 6090, 6121, 6123
  • inc/functions_calendar.php
  • inc/functions_forumlist.php
  • inc/functions_modcp.php
  • inc/functions_post.php
  • inc/functions_search.php
  • inc/functions_user.php
  • member.php
  • memberlist.php
  • misc.php
  • modcp.php
  • newreply.php
  • newthread.php
  • portal.php
  • printthread.php
  • private.php
  • reputation.php
  • search.php
  • showthread.php
  • usercp.php

should be change.

Contributor

ATofighi commented Jun 16, 2014

  • calendar.php: lines 413, 417, 421, 425, 429, 433, 444, 448, 452, 456, 460, 464, 500, 504, 1009, 1013, 1017, 1021, 1025, 1029, 1040, 1044, 1048, 1052, 1056, 1060, ...
  • editpost.php line: 790
  • forumdisplay.php lines: 240, 1240
  • global.php lines: 295, 299, 670, 688, 692, 715, 754
  • inc/functions.php lines: 1736, 1741, 1747, 2948, 2959, 2967, 3119, 3129, 3138, 3148, 3151, 3274, 3277, 3292, 3312, 3316, 3320, 3518, 3532, 4373, 4444, 4445, 4454, 4455, 4456, 4509, 4525, 4528, 5239, 6090, 6121, 6123
  • inc/functions_calendar.php
  • inc/functions_forumlist.php
  • inc/functions_modcp.php
  • inc/functions_post.php
  • inc/functions_search.php
  • inc/functions_user.php
  • member.php
  • memberlist.php
  • misc.php
  • modcp.php
  • newreply.php
  • newthread.php
  • portal.php
  • printthread.php
  • private.php
  • reputation.php
  • search.php
  • showthread.php
  • usercp.php

should be change.

@JordanMussi

This comment has been minimized.

Show comment
Hide comment
@JordanMussi

JordanMussi Jun 16, 2014

Contributor
$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 <strong> tags could possibly go in the language string but that's not removing the hard coded HTML. Using the template and passing $profile_link to it would be good as the theme designer can add/remove the <strong> tags wrapped around {$lang->ipresult_lastip} in the template.


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.
All of the above is just my opinion and may not reflect the outcome of this ticket.

Contributor

JordanMussi commented Jun 16, 2014

$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 <strong> tags could possibly go in the language string but that's not removing the hard coded HTML. Using the template and passing $profile_link to it would be good as the theme designer can add/remove the <strong> tags wrapped around {$lang->ipresult_lastip} in the template.


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.
All of the above is just my opinion and may not reflect the outcome of this ticket.

@Sama34

This comment has been minimized.

Show comment
Hide comment
@Sama34

Sama34 Jun 17, 2014

Contributor

In the las example there you can use the language system instead. Does $lastpost even needs to be not empty?

Contributor

Sama34 commented Jun 17, 2014

In the las example there you can use the language system instead. Does $lastpost even needs to be not empty?

@Sama34

This comment has been minimized.

Show comment
Hide comment
@Sama34

Sama34 Jun 17, 2014

Contributor

This should also take care of JS files with hardcoded links, which will require more complex fixes.

Contributor

Sama34 commented Jun 17, 2014

This should also take care of JS files with hardcoded links, which will require more complex fixes.

@JordanMussi

This comment has been minimized.

Show comment
Hide comment
@JordanMussi

JordanMussi Jun 17, 2014

Contributor

In the las example there you can use the language system instead. Does $lastpost even needs to be not empty?

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.

Contributor

JordanMussi commented Jun 17, 2014

In the las example there you can use the language system instead. Does $lastpost even needs to be not empty?

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.

@Eric-Jackson

This comment has been minimized.

Show comment
Hide comment
@Eric-Jackson

Eric-Jackson Jun 18, 2014

Contributor

Instead of using <strong></strong>, something along the lines of <span class="importantText"></span> would be more appropriate with font-weight: bold; set in CSS so they could be changes more globally rather than finding each <strong>. Regardless I do agree that even short ones like that should be moved into templates.

Contributor

Eric-Jackson commented Jun 18, 2014

Instead of using <strong></strong>, something along the lines of <span class="importantText"></span> would be more appropriate with font-weight: bold; set in CSS so they could be changes more globally rather than finding each <strong>. Regardless I do agree that even short ones like that should be moved into templates.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 19, 2014

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 ...

ghost commented Jun 19, 2014

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 ...

@Stefan-ST

This comment has been minimized.

Show comment
Hide comment
@Stefan-ST

Stefan-ST Jun 19, 2014

Contributor

There is also some HTML within the language files.

Contributor

Stefan-ST commented Jun 19, 2014

There is also some HTML within the language files.

PaulBender added a commit that referenced this issue Jun 21, 2014

@PaulBender

This comment has been minimized.

Show comment
Hide comment
@PaulBender

PaulBender Jun 21, 2014

Member

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

PaulBender commented Jun 21, 2014

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.

PaulBender added a commit that referenced this issue Jun 21, 2014

Working on #756 Remove Hardcoded HTML
Fixed bug in calendar.php

PaulBender added a commit that referenced this issue Jun 21, 2014

PaulBender added a commit that referenced this issue Jun 21, 2014

Working on #756 Remove Hardcoded HTML
global.php language option

PaulBender added a commit that referenced this issue Jun 21, 2014

Working on #756 Remove Hardcoded HTML
member.php (profile avatar, website and reputation vote link)

PaulBender added a commit that referenced this issue Jun 21, 2014

Working on #756 Remove Hardcoded HTML
misc.php (Syndication forumlist)
@Sama34

This comment has been minimized.

Show comment
Hide comment
@Sama34

Sama34 Jun 21, 2014

Contributor

@demonate the buddy code can be easily moved to a single template, not need for four.

Contributor

Sama34 commented Jun 21, 2014

@demonate the buddy code can be easily moved to a single template, not need for four.

PaulBender added a commit that referenced this issue Jun 21, 2014

Working on #756 Remove Hardcoded HTML
modcp.php part 1 (banning, mod logs and home page)

PaulBender added a commit that referenced this issue Jun 22, 2014

Working on #756 Remove Hardcoded HTML
portal.php (announcement post icon)

PaulBender added a commit that referenced this issue Jun 22, 2014

Working on #756 Remove Hardcoded HTML
printthread.php (multipage)

PaulBender added a commit that referenced this issue Jun 23, 2014

Working on #756 Remove Hardcoded HTML
search.php (post icon) and showthread (quick reply mod options and similar threads post icon)
@PirataNervo

This comment has been minimized.

Show comment
Hide comment
@PirataNervo

PirataNervo Jun 24, 2014

Contributor

@PaulBender don't forget to use the task list created by @ATofighi so you know when you're done.
Also remember that as you've been committing directly here, this must be done in time for Beta 2.

Contributor

PirataNervo commented Jun 24, 2014

@PaulBender don't forget to use the task list created by @ATofighi so you know when you're done.
Also remember that as you've been committing directly here, this must be done in time for Beta 2.

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
reputation.php (adding rep delete button and drop down options)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
functions_user.php (PM folders); cached some templates in reputation.php

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
functions_calendar.php (calendar jump)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
modcp.php part 2 (announcements, mod queue, edit user, ip lookup)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
functions_forumlist.php (moderators, last post, viewers, unapproved stuff)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
private.php (folder drop downs, message post icon)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
forumdisplay.php (moderators); renamed forumbit mod templates

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
functions_modcp.php (announcement icons) & functions_search.php (forum select box)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
functions_post.php (post icons, multiselect profile fields)

PaulBender added a commit that referenced this issue Jun 24, 2014

Working on #756 Remove Hardcoded HTML
calendar.php (birthdays, user stars and year drop downs)

PaulBender added a commit that referenced this issue Jun 25, 2014

Working on #756 Remove Hardcoded HTML
functions_post.php (postbit user stars); fixed showthread.php bug

PaulBender added a commit that referenced this issue Jun 25, 2014

Working on #756 Remove Hardcoded HTML
functions.php part 1 (post icons, thread prefixes, attachment icons and breadcrumb dropdown)

PaulBender added a commit that referenced this issue Jun 25, 2014

Fixes #454 Hide stuff users don't have permission to use
Hides theme selector in footer and User CP if only one theme exists; moved theme selector's hardcoded HTML to template (#756)

PaulBender added a commit that referenced this issue Jun 25, 2014

Working on #454 Hide stuff users don't have permission to use
Hide language selector in User CP if only one language exists and moved language option to template (#756)

PaulBender added a commit that referenced this issue Jun 25, 2014

Working on #756 Remove Hardcoded HTML
functions.php part 2 (reputation format and time zones) & calendar.php (hidden input for adding event when only one calendar exists)

PaulBender added a commit that referenced this issue Jun 25, 2014

Working on #756 Remove Hardcoded HTML
editpost.php (disable smilies hidden input), newreply.php (disable smilies hidden input), newthread.php (disable smilies hidden input) and functions.php (warning level formatting)
@PaulBender

This comment has been minimized.

Show comment
Hide comment
@PaulBender

PaulBender Jun 25, 2014

Member

Well, I'm almost done. Just a few more to go.

Member

PaulBender commented Jun 25, 2014

Well, I'm almost done. Just a few more to go.

PaulBender added a commit that referenced this issue Jun 26, 2014

Working on #756 Remove Hardcoded HTML
member.php, modcp.php and usercp.php (editing custom profile fields)
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 26, 2014

@Sama34 I'm sorry but I thought 4 button templates are required, "Add to Buddy List", "Add to Ignore List", "Remove from Buddy List" & "Remove from Ignore List" which are dynamic and alternately required based on the scenario. If you make a single template and use variables - then again hardcoded button HTML will come in picture. I'm still not sure where I'm wrong ...

ghost commented Jun 26, 2014

@Sama34 I'm sorry but I thought 4 button templates are required, "Add to Buddy List", "Add to Ignore List", "Remove from Buddy List" & "Remove from Ignore List" which are dynamic and alternately required based on the scenario. If you make a single template and use variables - then again hardcoded button HTML will come in picture. I'm still not sure where I'm wrong ...

PaulBender added a commit that referenced this issue Jun 26, 2014

Working on #756 Remove Hardcoded HTML
usercp.php part 1 (date & time formats, post/threads per page, forum subscriptions and avatar auto resize)

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
usercp.php part 2 (no buddies/ignored, draft thread/forum links, group leaders)
@Destroy666x

This comment has been minimized.

Show comment
Hide comment
@Destroy666x

Destroy666x Jun 27, 2014

Contributor

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.

Contributor

Destroy666x commented Jun 27, 2014

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.

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
usercp.php part 3 (joinable groups and members of groups)

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
usercp.php part 4 (home page, post icons)

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
Fixed minor bug in usercp.php
@JordanMussi

This comment has been minimized.

Show comment
Hide comment
@JordanMussi

JordanMussi Jun 27, 2014

Contributor

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.

Contributor

JordanMussi commented Jun 27, 2014

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.

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
member.php (user star, multi option profile fields, COPPA day dropdown)

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
memberlist.php (user star)
@PaulBender

This comment has been minimized.

Show comment
Hide comment
@PaulBender

PaulBender Jun 27, 2014

Member

Okay, this is done.

Member

PaulBender commented Jun 27, 2014

Okay, this is done.

@PirataNervo

This comment has been minimized.

Show comment
Hide comment
@PirataNervo

PirataNervo Jun 27, 2014

Contributor

That was quite some work!

Contributor

PirataNervo commented Jun 27, 2014

That was quite some work!

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
Missed two bits in usercp.php
@PaulBender

This comment has been minimized.

Show comment
Hide comment
@PaulBender

PaulBender Jun 27, 2014

Member

Though all the commits above, I have added 127 templates and removed one (usercp_options_stylebit).

Member

PaulBender commented Jun 27, 2014

Though all the commits above, I have added 127 templates and removed one (usercp_options_stylebit).

PaulBender added a commit that referenced this issue Jun 27, 2014

Working on #756 Remove Hardcoded HTML
Put code in wrong place >_<
@PirataNervo

This comment has been minimized.

Show comment
Hide comment
@PirataNervo

PirataNervo Jun 28, 2014

Contributor

@PaulBender make sure not to forget to cache templates! I don't have time to check if you did.

Contributor

PirataNervo commented Jun 28, 2014

@PaulBender make sure not to forget to cache templates! I don't have time to check if you did.

@PaulBender

This comment has been minimized.

Show comment
Hide comment
@PaulBender

PaulBender Jun 28, 2014

Member

I cached as I went. There shouldn't be any uncached templates.

Member

PaulBender commented Jun 28, 2014

I cached as I went. There shouldn't be any uncached templates.

@PirataNervo

This comment has been minimized.

Show comment
Hide comment
@PirataNervo

PirataNervo Jun 28, 2014

Contributor

Sounds good then :)

Contributor

PirataNervo commented Jun 28, 2014

Sounds good then :)

@PaulBender PaulBender added the fixed label Jun 29, 2014

@PirataNervo

This comment has been minimized.

Show comment
Hide comment
@PirataNervo

PirataNervo Jun 29, 2014

Contributor

Closing this. Bugs will be reported during Beta 2 testing period.

Contributor

PirataNervo commented Jun 29, 2014

Closing this. Bugs will be reported during Beta 2 testing period.

@JordanMussi

This comment has been minimized.

Show comment
Hide comment
@JordanMussi

JordanMussi Jul 3, 2014

Contributor

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?

Contributor

JordanMussi commented Jul 3, 2014

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?

@xykul

This comment has been minimized.

Show comment
Hide comment
@xykul

xykul Jul 4, 2014

Raise the thread or post approval
Go to index
functions_forumlist.php line 567 or 582 errors

eval("\$unapproved_posts = \"".$templates->get("forumbit_depth2_forum_unapproved_posts")."\";");
eval("\$unapproved_threads = \"".$templates->get("forumbit_depth2_forum_unapproved_threads")."\";");

or
AdminCP edit forum..
"Yes, moderate new posts" and "Yes, moderate new threads" click..
Whether members of this forum thread or send a message.
Administrators and moderators receive the above error.

xykul commented Jul 4, 2014

Raise the thread or post approval
Go to index
functions_forumlist.php line 567 or 582 errors

eval("\$unapproved_posts = \"".$templates->get("forumbit_depth2_forum_unapproved_posts")."\";");
eval("\$unapproved_threads = \"".$templates->get("forumbit_depth2_forum_unapproved_threads")."\";");

or
AdminCP edit forum..
"Yes, moderate new posts" and "Yes, moderate new threads" click..
Whether members of this forum thread or send a message.
Administrators and moderators receive the above error.

PaulBender added a commit that referenced this issue Jul 4, 2014

Fixes bug with #756 Remove Hardcoded HTML
Forgot to global $templates...
@JN-Jones

This comment has been minimized.

Show comment
Hide comment

PaulBender added a commit that referenced this issue Jul 10, 2014

Working on #756 Remove Hardcoded HTML
global.php (task image)
@Destroy666x

This comment has been minimized.

Show comment
Hide comment
@Destroy666x

Destroy666x Jul 14, 2014

Contributor

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;

Contributor

Destroy666x commented Jul 14, 2014

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;

@ATofighi

This comment has been minimized.

Show comment
Hide comment

@Sama34 Sama34 referenced this issue Aug 9, 2014

Closed

Remove hardcoded HTML v2 #1150

9 of 9 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment