Strigo
Strigo

Reputation: 21

How to use else if in html?

I am using joomla and i want to do this with my template!

<html>
   <?php if ($this['config']->get('home')) : ?>
      <div class="home">
       Some content
      <div>
   <?php else : ?>
      <div class="page">
       Some other content
      <div>
   <?php else if ($this['config']->get('blog')) : ?>
      <div class="blog">
       Some other blog content
      <div>
   <?php endif; ?>
</html>

My problem is that i can't use multiple ( else if ) in this code .

lets say like this:

<html>
   <?php if ($this['config']->get('home')) : ?>
      <div class="home">
       Some content
      <div>
   <?php else if ($this['config']->get('page')) : ?>
      <div class="page">
       Some other content
      <div>
   <?php else if ($this['config']->get('blog')) : ?>
      <div class="blog">
       Some other blog content
      <div>
   <?php endif; ?>
</html>

my english is not that impressiv so i hope you understand me

Upvotes: 0

Views: 123

Answers (1)

I&#39;m Geeker
I&#39;m Geeker

Reputation: 4637

You no need to use else if in last

<html>
   <?php if ($this['config']->get('home')) : ?>
      <div class="home">
       Some content
      <div>
   <?php else if ($this['config']->get('page')) : ?>
      <div class="page">
       Some other content
      <div>
   <?php else  : ?>
      <div class="blog">
       Some other blog content
      <div>
   <?php endif; ?>
</html>

Upvotes: 2

Related Questions