Jump to content

help with if statements


Darkwoods

Recommended Posts

Hello I got an jQuery tabs and every tab got ID "fragment-1", "fragment-2" and so on

 

now if want to tell PHP to use fragment-2 if fragment-1 is taken how do I do that?

 

Thanks

 

            <div id="fragment-1" class="ui-tabs-panel">

                <img src="assets/img/image1.jpg" title="" alt="" />

                <div class="info" >

                    <h1><?php echo $row['pr_title']; ?></h1>

                    <p>blabla..</p>

                </div>

            </div>

Link to comment
https://forums.phpfreaks.com/topic/241491-help-with-if-statements/
Share on other sites

I'm guessing what you mean is, that you have something that drives how many tabs you need.  If so, you should make a function that outputs the tab code, and generates the id based on a counter in the loop.  Inside that function the div would be something like:

 

function makeTab($id, $img, $h1, $para) {
  $out = '
                 return $out;
}

}

I'm guessing what you mean is, that you have something that drives how many tabs you need.  If so, you should make a function that outputs the tab code, and generates the id based on a counter in the loop.  Inside that function the div would be something like:

 

function makeTab($id, $img, $h1, $para) {
  $out = '<div id="fragment-' . $id . '" class="ui-tabs-panel">
              <img src="assets/img/' . $img . '" title="" // etc
   return $out;
}

 

 

Hey thanks for your reply but this wont solve the problem the jQuery tabs im using is for news posts so the fragment tabs have to be the same 1,2,3,4 it wont work with id.

 

is there a way to tell the mysql to echo the latest  second or third or forth post?

 

this way I can echo it in every fragment..

 

 

 

I'm guessing what you mean is, that you have something that drives how many tabs you need.  If so, you should make a function that outputs the tab code, and generates the id based on a counter in the loop.  Inside that function the div would be something like:

 

function makeTab($id, $img, $h1, $para) {
  $out = '<div id="fragment-' . $id . '" class="ui-tabs-panel">
              <img src="assets/img/' . $img . '" title="" // etc
   return $out;
}

 

 

Hey thanks for your reply but this wont solve the problem the jQuery tabs im using is for news posts so the fragment tabs have to be the same 1,2,3,4 it wont work with id.

 

is there a way to tell the mysql to echo the latest  second or third or forth post?

 

this way I can echo it in every fragment..

 

That is what he gave you.  Since you haven't posted any code, he gave you arbitrary code.  IN that you will have to fit it to your code.  It will not work as a drop in.  If you post code, we could give better responses.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.