Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Best way of moving HTML from core to skins is

30.8% 8
11.5% 3
53.8% 14
3.8% 1

26 Datum 9. September 2009, 01:20

Foren / Cotonti / Core Labs / Archive / Umfrage: Wiping HTML out from core

12NächsteLetzte

Discussing ways

Trustmaster
#1 9. September 2009, 01:20
This has been discussed many times here and there. I've encountered this problem once more with a PNG skin and would like to solve this problem at least as experiment. However, we have to decide what to do about HTML still-in-the-core in future (0.7 and up).

Assign many TPL tags and use TPL logic everywhere

Means putting all the HTML directly to those places they appear in templates. Define HTML in templates and assign tags for attributes and contents.

Pros: very pure Model-View-Controller (MVC) design, everything of layout is in the templates.
Cons: tens and hundreds of new {TPL_TAGS} to emerge.

Use spans + CSS for icons, leave the rest alone

Is described and discussed here

Pros: neat CSS for icons
Cons: may result in massive non-semantic markup, doesn't solve problem for everything except icons

Assign as PHP strings in skin_name.php

We could follow the footsteps of language files. The main goal for moving HTML from core to skins is to let the skin makers total control over markup and layout, including small details. But there are hundreds of such pieces and most of them contain HTML mixed with PHP code, so it is very hard to organize. Putting them to PHP strings e.g. $S in skin_name/skin_name.php would let skin makers customize those HTML snippets and keep the flexibility of PHP code.

There should be a default file with resource strings that comes with the core and provides all the necessary strings which will suit many (existing) skins out of the box. And any of those strings can be overwritten in skin_name.php, so you can customize only those strings you need and everything is standardized.

Pros: hit 2 birds with one stone, possible backwards compatibility
Cons: not pure

Questions/suggestions are welcomed.
May the Source be with you!

Dieser Beitrag wurde von Trustmaster (am 12. September 2009, 15:40, vor 11 Jahre) bearbeitet
Kort
#2 9. September 2009, 01:56
Now that the admin panel is (completely?) skinnable, are there any "hard-coded" links to gif-files left in the admin-related php-code? Flexible use of graphics would also be appreciated!
As regards the poll, with if-blocks "leave as is" would be a good option (still, linebreaks should be wiped out from the php-code!)
Seditio.by - создание сайтов, разработка плагинов и тем для Котонти
Trustmaster
#3 9. September 2009, 02:04
I found 66 occurrences of ".gif" in the core, not to count hundreds of hardcoded links, form items and bigger blocks.

Added 2 hours 53 minutes later:

"Assign as PHP strings in skin_name.php" description updated.
May the Source be with you!

Dieser Beitrag wurde von Trustmaster (am 9. September 2009, 04:58, vor 11 Jahre) bearbeitet
Sergeich
#4 9. September 2009, 05:08
Про третий вариант по русски можно, я не совсем понимаю что там за камни и птицы :)
Born in the Wild Wild East!
Sergey
#5 9. September 2009, 06:00
Я так сказать, дедуктивно понял, что есть иконка bird.png и ее предлагают вставлять типа {PHP.img.bird}
и будет такая, наверное глобальная переменная img, а $img['bird'] как раз и будет картинкой. Теперь берем и раз, все img и плагином (функцией) куда и в чего хочешь.
www.cotonti.mobi
Kilandor
#6 9. September 2009, 14:31
Images in core, could be handled with some sort of variable to control and output them so they can be customized.

Any div's should have a standardized matching class, there shouldn't be any td/tr really.

And english please guys
Trustmaster
#7 12. September 2009, 15:38
OK, I started work on this thing. I found it more reasonable to combine several approaches and move HTML from core this way:
  1. All images, icons and HTML resources with PHP embeds are moved to system/resources.php, which is separated into sections by module (PM, PFS, Forums, etc.)
  2. Form items, like inputs, selectboxes, textareas, etc. should better be coded in TPL files rather than core or resources.php. TPL tags, required for specific attributes, should be assigned in the core.
  3. Resource elements are provided CSS classes if neccessary. E.g. all icon images have class="icon".
I have started with common, functions and PFS, but it is quite a lot of work overall. So I need assistants to help with this task.
May the Source be with you!
Kilandor
#8 12. September 2009, 18:59
All images, icons and HTML resources with PHP embeds are moved to system/resources.php, which is separated into sections by module (PM, PFS, Forums, etc.)

This contains the urls for the images? if so this should be in skin not system.
Trustmaster
#9 12. September 2009, 23:30
Not just url, but entire HTML tag. For example, folder/file icons in PFS, PM icon, userlevel stars, etc.
May the Source be with you!
Kilandor
#10 13. September 2009, 01:51
Ok, I still think this should be in skin folder, cause if its being moved out anyways, its more likely for people to want to customize them, and some may use multiple skins?
Trustmaster
#11 13. September 2009, 03:10
Yes, if you read the first post again, these resources are defined in resources.php but it can be easily redefined in skin's php file because it's just an array.
May the Source be with you!
Kilandor
#12 13. September 2009, 15:54
Ok, well I was just going by your post about it you said "system/resources.php" :) but guess maybe meant the system folder in skins
Trustmaster
#13 21. September 2009, 17:25
I have made a practical research, committed code to trunk and written an article describing the way this task is to be done. Please read it and help applying it on trunk.
May the Source be with you!
SunChase
#14 22. September 2009, 19:18
i would say that the third option is the best
[url=http://ka13.orgfree.com]KA13[/url] - The essence of creativity
urlkiller
#15 20. September 2010, 02:22
is this dicontinuied? or ?

because why dont we use png sprites for the core system images?
so most icons could be done with css?!
URL shortener: <a href="http://bbm.li/!7AD5C7">http://bbm.li/!7AD5C7</a>

12NächsteLetzte