Current time: 06-19-2019, 06:48 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is HTML File the PHP File? (Defer JS Parsing)
12-27-2018, 02:55 AM
Post: #1
Is HTML File the PHP File? (Defer JS Parsing)
Hey guys, really awesome forum here this is exactly the type of people I need to be around for this leg of my Wordpress journey of speeding up my site.

I hope my beginner/novice tech skills aren't too offputting but I just want to double check I'm about to edit the right file here...

So I'm about to fix the defer parsing of javascript on my site for speed...

The best article I've found says:
Quote:1. Copy above code.

2. Paste code in your HTML just before the </body> tag (near the bottom of your HTML file).

I assume that when the author refers to the "HTML file" he is referring to the .php file in the wordpress database?

I couldn't locate an HTML file in my database so I'm assuming its .php.

Anyone run into this?

Thanks,
-Rob
Find all posts by this user
Quote this message in a reply
12-29-2018, 04:59 AM
Post: #2
RE: Is HTML File the PHP File? (Defer JS Parsing)
Short answer: No.

PHP is leveraged to generate the proper html code which is stored in other files. This is done to make content management easier.

Example: When creating a HTML website, you usually start with a index.html file with the following structure.

<html>

<head>
header tags here, like css/js/favicon/meta/etc
</head>

<body>
header
content
footer
</body>

</html>

When I finish my homepage, I continue with other pages. Now comes the fun part. I'm finally done, but realize my header menu is missing a link to a specific page ! I add it in index.html, but now I have to fix it in each page manually as well Sad

This can make fixing typos and adding new content very tedious.

What a CMS 'basically' does, is storing the html code, and calling it. The following is technically incorrect but serves as just an example:

<?php
echo "<html>"
echo $head
echo $body
echo "</html>"
?>

In the CMS (like WordPress), I created my menu. It's stored in the database and I can use php to just call the variable that holds the content. So $head will contain the html code for <head>blah</head>. And it will dynamically insert that when I browse a page.

The advantage is that when I need to edit something, I only need to do it in 1 place, and all pages will be updates at the same time.

-----

So you'll need to figure out where the actual html code is stored and edit it there. If you use a CMS (like WordPress), then there are plugins that can help you add code to different sections of your page.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)