Search code examples
phpmeta-tags

Is it possible to write an if statement for a PHP meta description?


I wanted to know if it was possible to write an if statement for an PHP meta description.

I know the basic description is this

<meta name="description" content=<?php echo e($this->video['title']); ?>

I am asking if it is possible to make an if statement to check if the title is blank or something like that.


Solution

  • I am not sure what your question is but it may be what you are looking for:

    if(e($this->video['title'])!=""){//Checking if title is not blank 
    ?>
    <meta name="description" content="<?php echo e($this->video['title']); ?>"><?php }?>