[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 538
  • Last Modified:

PHP File without PHP Code

I help maintain a website that uses Wordpress as the content management system in addition to using PHP templates. What I find puzzling is that when I looked into some of the files' contents, I could not find any PHP code. Instead the files only had HTML and JavaScript or JQuery. Can a file have a .php extension yet not have any PHP code in it?
0
geeta_m9
Asked:
geeta_m9
2 Solutions
 
GaryCommented:
Yep, still be processed as a php page but if there is no php code then it doesn't matter
0
 
Dave BaldwinFixer of ProblemsCommented:
Definitely Yes.
0
 
GaryCommented:
When you use php you tend to name all your pages .php even if there is no php code (at least I do)
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Ray PaseurCommented:
Sure.  PHP and HTML coexist nicely.  The PHP parse engine simply ignores anything that is not wrapped in <?php ... ?> tags.  So the HTML just flows through.
0
 
geeta_m9Author Commented:
So, can I put any web scripting code into a PHP file or is it just limited to HTML and JavaScript or JQuery?
0
 
GaryCommented:
web scripting code
Yes, a php page is parsed at the server where the php is interpreted (only php).  Any client side scripting is ignored as that is for the browser to parse.
0
 
geeta_m9Author Commented:
Ok. Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now