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
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;
}

}

Link to comment
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 = '<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..

 

 

 

Link to comment
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 = '<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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.