NetTalk Central

Author Topic: Change "class=" to "style="  (Read 5655 times)

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Change "class=" to "style="
« on: December 19, 2017, 05:49:29 AM »
I have one question is it possible to change web template to alter "class=" to "style=" in generated html, (div)...
The reason for this is that I want to change single prompt style,  without changing entire css for theme.
I want to some prompts be smaller or larger to distinguish it from other prompts in some form.
When I put in css prompt for some field code like this 'font-size:10px', after starting the web application, the element for that prompt isn't changed to appropriate style, in this case font 10px. (picture A)
But if I change this line in html directly, from "class " to "style" all works as I want it (picture B)
The question, once again, is ti possible in some later versions to put some check right after css entry for prompts,  or any other entry, to change html after generated from "class" to "style"
Regards, Oggy

To be precise: I want to use simple inline formating. instead of reusable classes. I know that I may put class with selected size to theme css, but in that way the css file will grow and grow...
Bruce?!?
« Last Edit: December 19, 2017, 06:56:41 AM by oggy »

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: Change "class=" to "style="
« Reply #1 on: December 19, 2017, 08:08:01 AM »
NetWebServerWorkerBase._divHeader procedure in NetWeb.clw, changes....
Regards, Oggy

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Change "class=" to "style="
« Reply #2 on: December 20, 2017, 11:42:31 PM »
Hi Oggy,

>> I have one question is it possible to change web template to alter "class=" to "style=" in generated html, (div)...

no, that would be a bad thing to do.

>> The reason for this is that I want to change single prompt style,  without changing entire css for theme.

You are falling into a classic programmer trap. In the effort to do things "quickly" you choose a bad solution, rather than do things "right". "Quickly" _always_ costs you time and effort in the long run. Doing things right is a little harder up front, but always pays off in the long run.

>> To be precise: I want to use simple inline formatting. Instead of reusable classes.

Exactly. And this doesn't seem like a problem to you now, but 5 years from now it will be a stone around your neck. Clarion programmers are always in such a hurry to do things quickly, that taking the time to do it correctly is always too much.

>> I know that I may put class with selected size to theme css,

exactly right. Add a class to the Custom.Css file, add it to the css for the prompt (with a leading space so it "adds" to the other classes) and then you have one class forever for "highlighted prompts."

>> but in that way the css file will grow and grow...

Exactly. And you _want_ it to grow and grow. For these reasons;

a) when you decide that should be 'font-size:12px' not 'font-size:10px' you will change it in _one_ place, not have to visit endless forms and manually change endless prompt settings. Or what happens when you want to "also make it bold"?

b) your theme is reusable. The next project you do can use all this existing work. No need to do it all over again.

c) your app will be faster. Since the CSS is downloaded once, and cached, and not swelling up every HTML page, the HTML will be smaller and the app goes faster.

_Separating_ "Design" from "Content" is a HUGE advantage, and one that NetTalk apps have built-in right form day one. The lack of a visual designer spurs this separation, and encourages CSS reuse. Your suggestion is a step backwards, not a step forwards.

cheers
Bruce

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: Change "class=" to "style="
« Reply #3 on: December 21, 2017, 01:28:30 AM »
Bruce, thanks for response. As you say : "Clarion programmers are always in such a hurry to do things quickly..", you are absolutely right ;)
Because of this I was asking if you can change or re-arange this great template.... OK, after your post and we says: " jutro je pametnije od noci" or in my bad english: "dawn is smarter then night" , I will use class to this....
One question, if such css file grows over time, is it possible to response of application be slower?!? The css file will be in gz file, but...
Regards, Oggy.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Change "class=" to "style="
« Reply #4 on: December 21, 2017, 01:53:58 AM »
Hi Oggy,

>>  possible to response of application be slower?!?

short answer: no.

longer answer: the actual performance will likely be quicker as the user works. It'll be _slightly_ slower to load the first page, but by such a small amount that it'll make no perceptible difference. I mean even if it was like 100K bigger I doubt you'd be able to notice.

cheers
Bruce


oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: Change "class=" to "style="
« Reply #5 on: December 21, 2017, 02:01:33 AM »
Great... Just one question and I close the year  :). No question for you any more, until another year.
For my main application, now on NT7 (still), i got this performance scores (screenshot)
What about enable-keep alive and javascript defer parsing in NT10?
Have a nice day and happy new year.


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Change "class=" to "style="
« Reply #6 on: December 21, 2017, 07:13:35 AM »
>> For my main application, now on NT7 (still), i got this performance scores (screenshot)

I guess if you're on NT7 you don't really care about performance anyway :)
NT 8, 9 and 10 have all been faster than the one before...

But, yes, both are on the horizon for NetTalk 10.

cheers
Bruce