开发者

how to extract and separate php and html from source file

Any suggestion on how to extract into开发者_StackOverflow separate files php code and html from a source file which is sprinkled with both.


There is no silver bullet, you could choose to view the webpage, view source, save it, then edit that file with placeholders and write new PHP code to replace the place holders with what you want.

But some people will argue that PHP is a templating language, and it should be intermixed. I don't use it that way, but they are correct.


No way to do it automatically.

That's what programmers are for ;)


Well, you could always look for the PHP tags in the file and split using them?

<?php and ?>


You can use any language or application with text precessing capabilities (perl, or python my favorite) and find the tags. After finding the tags you can get the text in between and manipulate it as you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜