-1

I have alt and title tags that contain data from a table that are appended with the base_url that I would like to remove. When I do so the alt tags show up empty. Currently the is what the code is:

<img title="<?php print_r(base_url().
        $promo5['data'][0]->CarouselImageTitleAtribute);?>" 
     alt = "<?php print_r(base_url().$promo5['data']
       [0]->CarouselImageAltAtribute);?>'/.

The result is this:

<img title="https://www.example.com/Click here to read about 
           our custom products" 
     alt = "https://www.example.com/Custom colored products"/>

I need to remove the https://www.example.com/ and only keep the value in the table (CarouselImageAltAtribute) I have tried using

<?php echo $promo5->CarouselImageAltAtribute; ?>

With no luck.

Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
B. L.
  • 33
  • 2
  • 6
  • Thanks, i am not that familiar with PHP and was frustrated with the developer dragging his feet on this so i thought I would fix it myself. But I see the logic and appreciate you help; it is working! :) – B. L. Aug 04 '17 at 18:33
  • Just want to add for those who may be unaware that base_url() is a PHP function available with codeigniter and is not a built-in PHP function; see here: https://stackoverflow.com/questions/38122186/set-up-the-base-url-in-codeigniter/38122285#38122285 – slevy1 Aug 04 '17 at 21:05
  • B. L. please mark the answer as you said it worked for you.Thanks – Alive to die - Anant Aug 05 '17 at 04:25

1 Answers1

2

Remove base_url() code from alt="" and title="" like below:-

<img title = "<?php echo $promo5['data'][0]->CarouselImageTitleAtribute;?>"
   alt = "<?php echo $promo5['data'][0]->CarouselImageAltAtribute;?>"/>
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98