Php to python web2py converter

Moving from PHP to Python. Is it Possible [Python]:

PHP to web2py:views converter

Mind that web2py follows a model-view-controller design and this app is only desigend to translate php code embedded in html. This converter is a proof of concept and it is mainly designed to help you port PHP page layouts to web2py. It does not always work. It will convert the code in the HTML and will place all PHP variables in a “php” container object. It will not convert PHP functions into the equivalent Python function.

click here to learn more about web2py (for PHP programmers)

Place here the PHP code


The web2py code

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
{{from  gluon.storage import Storage; php=Storage()}}

{{
php.language=Storage()
php.language.language=request.env.accept_language or 'unknown'
php.head='<!-- head here -->'
php.styles='<link rel="stylesheet" type="text/css" href="%s" />' % URL(r=request,c='static',f='style.css')
php.left=False
php.right=False
php.scripts=''
php.body_classes=''
php.logo=URL(r=request,c='static',f='logo.jpg')
php.head_title=response.title
php.header=''
php.head=''
php.search_box=None
php.site_name=response.title or 'response.title'
php.site_slogan=response.subtitle or 'response.subtitle'
php.primary_links=response.menu
php.mission='MISSION'
php.breadcrumbs='BREADCRUMBS'
php.tabs='TABS'
php.help='HELP'
php.messages=DIV(response.flash,_class='flash')
php.feed_icons='FEED_ICONS'
php.footer='FOOTER'
php.closure='CLOSURE'
def isset(obj): isinstance(obj,(list,tuple))
def theme(*a,**b): return ''
}}
<html>
<body> 
{{for php.i in xrange(0,10): response.write('hello world')}}
</body>
</html>
0

0
 

Leave a Reply