Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Best way to get a dynamic url match using PHP

Recommended Posts

  • Owner

I am trying to find a solution for blocks used here on the site and for that I need a way to match urls  to echo out content. This is because the widget areas are global so in a database for example that block will show up on listings and entries alike, which is not a good thing.

Now I can simply use a URI match like this:

$host = $_SERVER['REQUEST_URI'];
if($host == '/projects/')
    echo ('

<div class="hero_block projects_hero">
  <div class="hero_block_left_wrapper">
  <div class="hero_block_left_content">
    <h1>My Projects<span>.</span></h1>
    On this site you can find all kind of things related to IT development and topics such as Atlassian, Security and E-Commerce. The purpose of this website is to help people like you with questions you might have or to help promote you and your abilities.
      There are no stupid questions here and you will always be treated with respect. Some features on this site is only available for members, such as the ability to guest blog or post in the forums. Most is available without you needing an account, but if you want to help me expand this site, then I would be very happy if you choose to become a member!
   <a class="ipsButton ipsButton_veryLarge ipsButton_important" href="https://jimiwikman.se/contact//"><b><i class="fas fa-envelope-open-text"></i>    Contact me regarding project opportunities</b></a>
<div style="clear:both;"></div>


This will just output a set of HTML on the  URL https://jimiwikman.se/projects/.

This works fine, but I also want this to show up on all pages when using the pagination.

So I can manually add each page, but that is a lot of manual work. Since all pages have the same URL structure I want to add a wildcard to the url match: https://jimiwikman.se/projects/page/*

The question is just how I do that?


Link to post
Share on other sites
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...