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 ('
<divclass="hero_block projects_hero"><divclass="hero_block_left_wrapper"><divclass="hero_block_left_content"><h1>My Projects<span>.</span></h1><p>
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.
</p><p>
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!
</p><aclass="ipsButton ipsButton_veryLarge ipsButton_important"href="https://jimiwikman.se/contact//"><b><iclass="fas fa-envelope-open-text"></i> Contact me regarding project opportunities</b></a></div></div></div><divstyle="clear:both;"></div>
');
}
else
{
echo('');
}
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/*
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:
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 comment
https://beta.jimiwikman.se/forums/topic/1395-best-way-to-get-a-dynamic-url-match-using-php/Share on other sites