0

I've made progress here , updating this support request .. i cannot add code to this it won't save - this is very difficult , spent 5 minutes sending this simple message.

ltrim removes prefix "/" AND .. preg-replace remove suffix "?page=*"

so that : URL = /city = city URL = /city?page=* = city

purelocal
  • 1
  • 2
  • Echo or print the `$host` variable to see what the value contains, then that should help see how that looks. I'm thinking a slash may be missing. One thing with the comparison, use double quotes instead of single, and change the `=$profession[filename]?>` portion to `{$profession['filename']}`, since that part is already within PHP context. Also, though it might not error, short tags for the last `}` should have ``. – Paul T. Oct 15 '20 at 01:00

1 Answers1

2

You can't use <?=...?> inside a string, that can only be used when you want to print something from a context that's printing literal text.

Either use variable interpolation in a double-quoted string:

if($host == "https://www.purelocal.com.au/{$profession[filename]}")

or concatenation:

if($host == 'https://www.purelocal.com.au/' . $profession[filename])
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • If the variable is: =$profession[filename]?> , eg : category-name If URL = category-name THEN blank ELSE SOMETHING how can i put this variable inside a PHP if URL string statement ? – purelocal Oct 16 '20 at 02:01
  • something like this ? 1 2 } ?> – purelocal Oct 16 '20 at 02:04
  • Variables aren't expanded inside single quotes, only double quotes. – Barmar Oct 16 '20 at 02:07
  • See https://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in-php – Barmar Oct 16 '20 at 02:07