0
I want to make a if
to compare Urls, I tried using parse_url
... but I’m not sure how to use it. Someone could help me out a little?
<?php
$url1 = parse_url ( "http://enquetegoias.esy.es" );
$url2 = parse_url ( "http://enquetegoias.esy.es/pesquisa.html" );
?>
<?php if ($url1['host'] == $url2['host'] ): ?>
<meta property="og:image" content="http://enquetegoias.esy.es/img/logo.jpg" />
<meta itemprop="image" content="http://enquetegoias.esy.es/img/logo.jpg" />
<?php else: ?>
<meta property="og:image" content="http://enquetegoias.esy.es/img/votacao.jpg" />
<meta itemprop="image" content="<?=URL?>img/layout/votacao.jpg" />
<?php endif ?>
You want to compare to get that result ?
– Gabriel Rodrigues
If url1 equals http://enquetegoias.esy.es{ <meta Property="og:image" content="http://enquetegoias.esy.es/img/logo.jpg" /> <meta itemprop="image" content="http://enquetegoias.esy.es/img/logo.jpg" />} else{ <meta Property="og:image" content="http://enquetegoias.esy.es/img/votacao.jpg" /> <meta itemprop="image" content="<?= URL? >img/layout/voting.jpg" />}
– Fernanda Ferreira
Try to clarify your question a little more. What is the expected result? The check is correct.
– Marcelo de Andrade
For example, if the user’s page is http://enquetegoias.esy.es then I want it to appear: <meta Property="og:image" content="http://enquetegoias.esy.es/img/logo.jpg" /> <meta itemprop="image" content="http://enquetegoias.esy.es/img/logo.jpg" /> but if the usurer is in http://enquetegoias.esy.es/pesquisa.html I want it to appear: <meta Property="og:image" content="http://enquetegoias.esy.es/img/votaca.jpg" /> <meta itemprop="image" content="<?= URL? >img/layout/voting.jpg" />
– Fernanda Ferreira
Can you do it? @Fernandaferreira
– Sr. André Baill
I couldn’t, I couldn’t
– Fernanda Ferreira
managed to develop?
– Sr. André Baill
Not yet (I stopped stirring). You’re having the same difficulty?
– Fernanda Ferreira