In page.tpl.php place the following code: This example uses strpos() which is less resource intensive but may run into problems on pages where the url contains both sub strings, eg. example.com/marketplace/blog/ may behave like a blog instead of a marketplace. N.B. All code to be further tested and modified.
<!--?php
$url_tail = $_SERVER['REQUEST_URI'];
if (strpos($url_tail, "/blog/") !== false)
{
#output blog logo
}
elseif (strpos($url_tail, "/marketplace/") !== false)
{
#output marketplace logo
}else
{
#output logo as normal
}
?--> While this example uses preg_match() which is slower but more precise:
<!--?php
$url_tail = $_SERVER['REQUEST_URI'];
if (preg_match('/(\/blog\/)(.*)/', $url_tail))
{
#output blog logo
}
elseif (preg_match('/(\/marketplace\/)(.*)/', $url_tail))
{
#output marketplace logo
}else
{
#output logo as normal
}
?--> - URL
- Identifiers
- Domain name system
- Communication
- Uniform Resource Locator
- Example.com
- Identification
- Information
- Technology Internet
- php
- php
Section:
| Attachment | Size |
|---|---|
| 658 bytes |



Comments
Less theme overhead
Using this code means that you don't have to have different themes if only the logo is changing. Block visibility can be used in conjunction with this to create 'virtual themes', but only using one theme.
Add new comment