C
C
Corak2014-09-20 18:59:23
PHP
Corak, 2014-09-20 18:59:23

PHP: How to declare a variable in an array including any characters for a link starting with '/?'?

You need to include a variable that includes all links starting with '/?' or another more adequate solution in php request:

<body<?php echo (in_array($_SERVER['REQUEST_URI'], array('/en', '/ru', '/', '/?'))) ? ' class="homepage"':''; ?>>

General Purpose - it is necessary that on each start page it is displayed <body class="homepage">, that is, the homepage class is assigned Only for the start page and links described in the array (since this class is used in the design only on the main page of the site).
You need to somehow include in the array ALL links like "mypage.com/?", "mypage.com/?fb"... and any where after /? any character set goes. I suspect that through a variable, but what is the best way to describe this variable?
The situation is this:
I don't have the slightest experience with Php Requests.
There is a php template/start page template for a Joomla site.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
KorsaR-ZN, 2014-09-20
@Corak

What are you talking about? ... In Joomla, this can be solved almost by regular means.
From your text, the task is not entirely clear, do you need to hang up a class on the body only for the initial page? or for a specific set of pages?, if only for the start page, then you can track it by itemId, if for a set, then you can use the style of the template tied to the necessary menu items, and depending on the style, set the class or not ...

S
Sergey, 2014-09-20
Protko @Fesor

I will say only two words - Regular expressions.
ideone.com/zdwUPE

_
_ _, 2014-09-20
@AMar4enko

And to pay for an hour of work to a person who knows what and how to do - the toad crushes?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question