Jump to content

seems to be simple but not getting the logic, please help


jaikar

Recommended Posts

Hi,

 

i am traped in a problem..

 

i have a code where i am echoing the html for different conditions. example..

if($i == 1) {
      $tbcontent .=  '<div>new content</div>'
} 
if($i == 2) {
     $tbcontent .= '<p>hello</p>';
} 
if($i == 3) {
    include('newhtml.php');
}

echo $tbcontent;

 

 

now here is the problem.

 

i am concatenating the tbcontent and echoing finally, it has to happen only in that way because all the condtions are in the loop and have to echo finally. now for the 3rd condition, the htmls are from an include file. its a very long html with embedded php. because of the include, the html document structure is change as it echoing befire i echo the tbcontent. another problem is, this iinclude has lot of variable in between like a junk, so if i put this all in a function, then i have to set all the variables as global where i am sure there will be alot of confusion. what i wanted is, i want this included html to be echoed while i echo the tbcontent in sequence.

 

please advise..

 

Thanks !

 

Link to comment
Share on other sites

not actually working, am i making any wrong?

 

			while($result=mysql_fetch_assoc($query)) {
			$tab_name = ucfirst($result['tab_name']);
			$selected = '';
			if($result['selected'] == 1) {
				$selected = 'class="selected"';
			}
			if($result['type'] == 1) {
				$form = new form($result['table_name'], $result['fgroup_id'], $result['fgroup_name'], '{auto_insert:0, auto_responce:1}');
				$tcontent = '<div class="tabcontent" id="tab_'.$result['tab_id'].'">';
				$tcontent .= $form->print_form;
				$tcontent .= '</div>';
			}
			//echo $tcontent;
			if($result['integrate_uploader'] == 1) {
				$tcontent .= '<div class="tabcontent" id="tab_'.$result['tab_id'].'_uploader">';
				ob_start();
				include(INCLUDE_PATH.'function.uploader_form.inc.php');
				$tcontent .= ob_get_contents();
				ob_end_clean();
				$tcontent .= '</div>';
				//echo $tcontent;
			}
		}			

 

echoing tbcontent before including also wont work as, there is a dynamic menu that gets generated, so if i echo anything, it will change the complete document model. for now i have only one way, because of this there has to be 2 while loops, and thats working, but 2 while is not necessary if there is a solution to hold the html of included file inside a variable.

 

any suggestions are very much appreciated !!

 

Thanks !

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.