PHP code and it's Effect on SEO [closed] - php

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
So in order to minimalize code and optimize speed of my website I have used much PHP code. I used it to contain the entirety of the header and footer of my website.
<?php include('header.php') ?>
...Content...
<?php include('footer.php') ?>
In doing so I had trapped the title meta-tag within a PHP file, so in order to change the Title for each unique page I used a PHP variable placed above the header to adjust it like so:
<?php $title="Page Specific Title" ?>
<?php include('header.php') ?>
...Remainder of site.
I have tested this out and it clearly works within the browser. However, now that I am looking into SEO for my website, I am curious.
Does using PHP to populate SEO related meta tags have a negative impact on the SEO of the page?
If so, my follow up question would be what way can I optimize the speed of the website without negatively impacting the SEO of the individual pages? Would JavaScript work or am I confined to HTML?
Thank you in advance for any that can help.

Search engines visit sites almost like a user, by which I mean a page is prepared by the server and sent to them. PHP is whats running on your server to create that page, including setting the title to the value of the variable. So what the search engine get is the output of your PHP with the variable replaced with the value.
So no, using PHP will not effect your SEO.

Related

Building a html, css & javascript pages for wordpress without php? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So as the titles already states, is it possible to build a fully functioning wordpress page layout/theme using only frontend languages? And how will I incorporate it into wordpress without php?
Thanks!!!
Well no but you could certainly get away with using very little.
Just have
<?php get_header(); ?>
at the top of every page and
<?php get_footer(); ?>
at the bottom
A page named header.php with
<?php wp_head(); ?>
at the top and a page named footer.php with
<?php wp-footer();?>
at the bottom should get you going. From there just use html and javascript like normal.
HOWEVER this is leaving out 99% of the reasons to make a WordPress theme in the first place. It's a good place to start learning but if you want to make themes your gonna want to learn php.
This tutorial worked well for me.
https://www.youtube.com/watch?v=k7olvEeBM2I&index=3&list=PLpcSpRrAaOaqMA4RdhSnnNcaqOVpX7qi5
Good luck!

Default php include on all pages [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
On my site I have overall header and footer that are being created by functions header() and footer(), accessible in overall.php file. All sites are based on the same template so it looks like following:
<?
include ("/overall.php");
header();
echo "<div>";
// content of site
echo "</div>";
footer();
?>
I am thinking about another solution - maybe make a function createsite($content):
<?
function createsite($content)
{
header();
echo "<div>".$content."</div>";
footer();
}
?>
so that it would be simplier to create new page (there will be more than hundred of them). What are your ideas? I have been thinking about something like default include of overall.php on all sites. I hugely prefer clear PHP over frameworks like symfony or zend.
You will probably end up doing the same thing all of the frameworks are also doing, which is having a single point of entry for all your pages which will include all the neccesary functions (such as those in overall.php) and then redirecting the user to whichever actual page they want to see by including that as well.
Keep in mind that what you're currently building is (or rather, will be) a very basic framework in its own right.

Sectioned PHP website like Wordpress [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am working on a PHP website, and don't want to have to write headers, footers, etc. for every page. I came up with the idea to have written headers and footers that could be retrieved with a function just like Wordpress. I found Wordpress's get_header(); function in /wp-includes/general-template.php but it loads through a template which I do not have being a hand written website. My question is "How do I write multiple PHP files such as header.php, and footer.php, etc. and compile them in to one document in the index.php?
Look into the include() function, along with the similar include_once(), require(), and require_once().
A. Make sure your index page is index.php and not index.html.
B. Write one header file, header.php, and use if/else statements to bring in the content you want for that particular page.
C. Use <?php include('header.php'); ?>at the top of your index.php and <?php include('footer.php'); ?> at the bottom of your page.
D. If this isn't working, make sure your server has PHP installed on it.

Is-it worth to split a page into many pages? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've got a question about php and pages :
Is-it worth to split the code into many other files ?
So at the end, the index.php would be composed of :
include 'footer.php';
include 'header.php';
include 'home.php';
include 'load.php';
[...]
Or should I put all the code in an unique page ?
Other question, if I include a php page, could all the vars created in the included page be used in the main page, or should-I use $_SESSION ?
Thank you all for your help !
As for your main question it’s worth. In fact, it will be a pain for you to manage your web page if you don’t follow this method in the long run. I am not a php guy but I can tell you this because this is a universal truth. The idea here is to write once and use anywhere necessary. You don’t want to write the same thing again and again, do you? That’s why we produce function when programming. We define a function and use it as many times we want. Now consider you have suddenly found that you need some modification to do , as you have created a function you can make the change in just one place and it will be reflected everywhere without touching a single line of code outside the function’s code. In actual project change is a constant. That’s why we find many design pattern in the software industry like MVC.
In a web project, mostly (not always) the header, navigation, footer are same across all the pages. Therefore, you should consider making different file for these stuff and you should always put your content in your index.php file which are unique for index page.

How to separate this PHP and HTML source [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I have a change_username.php which makes it possible for users to change their username. If they changed their username a page like "Your new username ist xxx" or "xxx is already used" will be displayed.
I don't want to use an echo and put all the HTML stuff in there.
My first idea would be to create another 2 PHP's which then get the username from the change_username.php and display a proper result with HTML.
Are there any alternatives / better ways to do that? Creating files for every result sucks as much as putting the HTML data in an echo.
If I understood your question correctly you want to include a page with in your PHP: try using this as reference http://www.w3schools.com/php/php_includes.asp
You can include the page using
include 'filename';
or
<?php include 'menu.php'; ?>
I hope this helps you
I would do it a little bit differently, I think the problem is with managing the code where large page is getting messy. What I do in these cases I just use functions with parameters. So I create a lib.php file, where I store function with HTML blocks of code being echoed. Then when I need I call these functions in the necessary files, just requiring lib.php at the top of my page.

Categories