Link to access pages

Asked

Viewed 55 times

-1

How do I click on the products example link, change only content example and leave header and footer quetos? do with Slin and Rain frameworks, HELP!!!.

2 answers

1

You can use PHP for this:

For example

<section class="section">
  <div class="container">
  <?php
  $url = (isset($_GET['url'])) ? $_GET['url'] : 'login';
  $url = array_filter(explode('/', $url));

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

  if (is_file($file)) {
    require_once $file;
  } else {
    require_once './pages/404.php';
  }
  ?>
  </div>
</section>

Where you will also need a htaccess:

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^(.*)$ index.php?url=$1 [QSA]

What this code basically does is call the file php inside the pages folder indicated in url: exemplo.com/contatos without .php at the end if the page exists it is included if it does not return the page 404.php

0

You can dynamically load product properties via ajax or use a front-end framework. The easiest way is to load the data dynamically through ajax, because you do not learn from night to day a framework, and if it misuses the damaged is you in a short time.

Browser other questions tagged

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