I would like to share a page on facebook with a dynamic url.

Here is the code to get the dynamic url.

 $profie_url =  $this->url(array("id" => $mRow->id, "url" =>
                $this->urlify($mRow->first_name)) , "details") ."/" . $this->urlify(trim($mRow->subtitle)) . "/" . $this->urlify(trim($mRow->city_name));

To use it I usually do:

href="<?php echo $profie_url?>"

The code below is to share on facebook. How can I change the static url by a dynamic url?

<div id="fb-root"></div> <script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/fr_CA/sdk.js#xfbml=1&version=v2.8";
  fjs.parentNode.insertBefore(js, fjs);
 }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-share-button" data-href="https://www.mywebsite.com/" data-layout="button" data-size="large" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.mywebsite.com&src=sdkpreparse">Partager</a> </div>