0

Hello, i'am newbie. I don't know about programming language,in each language, i only know "hello world".

Javascript is spend more expensive bandhwidth. Especially for Limited Account of hosting.

Is it possible to convert javascript to php or html ???

4
Contributors
5
Replies
17
Views
7 Years
Discussion Span
Last Post by angelicakirana
0

Hello, i'am newbie. I don't know about programming language,in each language, i only know "hello world".

Javascript is spend more expensive bandhwidth. Especially for Limited Account of hosting.

Is it possible to convert javascript to php or html ???

Ther are online tools, such as, yellowpipe.com that convert HTML to a few other scripting languages, but to my knowledge you cannot convert javascript to PHP without rewriting the source code.

By the way JavaScript is not bandwidth extensive or costly 'to you' because it does not communicate with your server. It is client side only.

Edited by Banderson: n/a

0

Great !

I remove all related javascript file before.
Because I'd suspect that the javascript consume more resource and heavy loading +very slowly .
But now i don't need to worry about bandwidth.


Thank you for the link.
That tool's cool.

I think, i must rewrite the code. But, i should know which is best written in javascript or php.
Then, i can partially convert it, if needed. Is it right?

I want my javascript load faster, as fast as html.

Would you like to give me a "to do list" to help me learn "on the right path"?

It's nice to integrate javascript and php "beautifully" :D

@Banderson Thank You Very Much

Edited by angelicakirana: n/a

0

PHP is executed at the server, javascript is executed in the browser. Like html, javascript is plain text. So of course it loads as fast as html - it is simply sent directly to your browser, just like html. Your browser or computer might be slow at using the script and there's nothing you can do about that, apart from upgrading.

If you use external javascript files, as you should do most of the time, the file will be cached on the user's PC, and so when needed a second time, it will not be retrieved from the server.

You can't convert javascript to html - it is a script that is designed to be executed and alter existing html, to provide effects in the browser, to provide user interaction without the user having to reload the page from the server. PHP interactions however always require a call to the server and the page to be resent. So trying to do the same thing in php that javascript can do would be a slower process as the server would be involved at every stage and new pages would have to be sent to the user.

So I think you should start by asking yourself what exactly you think you are trying to do and whether you actually need javascript or PHP at all.

Edited by drjohn: n/a

0

You need to assess what you're trying to achieve. Unless you need to make changes to the HTML once it has been written, js can be avoided. Js is usually used for 'interactive' purposes. PHP is done and dusted by the time the page is displayed - so it is not 'interactive'. It is 'dynamic' however. It can change what HTML is passed on before page display. Based on variables/conditions, different content (via db/files/internal code) can be 'served'.

Recently, AJAX has really taken off - where php and js are combined to provide server-retrieved data without refreshing/reloading the whole page. I love it, but it can be overdone. Many think that it saves on server calls, but if not used sparingly, it can considerably increase server calls.

Personally, I use php to provide content and js to alter on-page display, e.g. sortable tables. For advice on where to use js and how to provide a working webpage for those who don't/can't have js enabled, Google "Progressive Enhancement".

Edited by diafol: n/a

0

@Banderson,drjohn,ardav ,

All of your answer give me the clue.

I must back to basic & learn more seriously.

Thank you.

I love this forum :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.