interesting read from RapydML.

{% extends basic.html %}

For those unfamiliar with it, the above line includes HTML from basic.html
inside of the current page. This is a useful technique to avoid unnecessary
copies of HTML that's common to multiple pages (this includes navigation
menus, website logo, etc.). The above logic, however, can also be
substituted with RapydML's importstatement, importing RapydML logic from
another page. For example, I can create a template.pyml file, declararing a
function for generating a chunk of reusable HTML inside of it, and then
invoke that function in every place I want that HTML to appear. Which
solution is better?

If you're an experienced web developer, you probably know that on most
hosting services storage space (especially for text/html) is relatively
cheap compared to bandwidth and CPU usage. The bandwidth requirements in
this case are the same, since both, template engine and RapydML logic
happens before the page is served to the client. The main difference is
that by using extends, you force your template engine to dynamically
generate that HTML content before serving it to the client (using up CPU
cycles, smart engines will probably cache this data), while by using import you
make your compiler generate that HTML once and serve it repeatedly to your
clients (using up a bit more storage space, which is not even significant
when comparing it to storage taken up by images and other multimedia
files). As a rule of thumb, I recommend using RapydML's logic over
Django/Rails/web2py unless it's something that requires information that
will not be available until runtime (i.e. news that you retrieve from the
database, interactive form that deals with user input). It's not too
different from preferring CSS over JavaScript for styling that doesn't
change dynamically.


2014-06-09 14:51 GMT+01:00 António Ramos <ramstei...@gmail.com>:

> I think i need something like that.
>
> cleaner is simple to read ..
>
>
> 2014-06-09 3:35 GMT+01:00 nick name <i.like.privacy....@gmail.com>:
>
> Does anyone have experience with RapydScript (lightweight py-like to JS
>> translator) and RapydML (pythonic-template to html/xml/svg translator)?
>>
>> Have just discovered them, and from a cursory examination they seem
>> extremely nice and useful. RapydScript seems to bridge the JS<->Python
>> bridge better than other projects I've looked at (PythonJS, Skulpt,
>> Pyjamas, Brython) - it goes much farther than Brython, for example, but
>> produces very readable and debuggable javascript that still works on IE8.
>>
>> RapydML explicitly shows how to support web2py in its documents ( ... as
>> well as plain html and django).
>>
>> Does anyone have any experience with them?
>>
>> https://github.com/atsepkov/RapydML
>>
>> https://github.com/atsepkov/RapydScript
>>
>>  --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to