Get a page with PHP or Ajax?

Asked

Viewed 69 times

0

I own the following código to get pages in my contents with url friendly:

<?php
$url = (isset($_GET['url'])) ? $_GET['url'] : 'home';

$url = array_filter(explode('/', $url));

$file = './pages/' . $url[0] . '.php';

if (is_file($file)) {
  include_once $file;
} else {
  include_once './pages/404.php';
}
?>

But then the question arose, "?" What better way to do this, with php or ajax ? Which is safer, which interferes more in the SEO website? Which is more agile?

  • What is the reason for the signage? My question is very clear, please leave a commenting

  • 1

    The second closing vote is mine. To understand, what you presented is confusing, not clear enough and even if it was clear it seems to be too broad that it is the choice of the first one who voted. But I’ll give you a chance. Maybe by clarifying better what you want and what the purpose of this is. The confusion is in "ajax" because ajax seems to have no use there in what presented. Unless I explain the context and, as that is lacking, it is what motivated me to vote as not clear enough. Did you find the comment confusing? Imagine who you read what you posted.. rsr

  • Truth is I don’t have the ajax code yet, but the bottom question is that it’s running... not the code presented to make it clear.

1 answer

-1


I think I understand your question. Well come on.

first- AJAX cannot be compared to PHP, because it is a Jquery plugin to do things like requests without refresh on the page or even receive texts like JSON or do a password validation, all taking into account that you are using php as back-end.

2nd- PHP is the best way to do what you want. Because you are making file includes on your page and probably these includes contain values and variables that need to be used somewhere in your code.

  • 1

    All right, I think there will be no better answer. In question to SEO, I searched and found nothing about.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.