Reputation: 49
Im trying to remove "Click" out of the code after it has been used. I need it to work in the beginning but after the class="details" is used, i need the code removed. I figured I could use PHP for this?!?!?!
I know that I can use PHP to remove the HTML and I have been trying to use the preg_replace() function but its not working.
I cant color code the individual lines so i have have place large space about and below the HTML instance i need and also below where the line occurs again, where I need the HTML to be removed.
I hope this makes sense.
Thank you in advance for all your help.
<?php
/**
* @file
*/
?>
<div class="cloud-computing-item">
<div class="container">
<div class="item-header">
<h3> <?php print $company['name'] ?> </h3>
</div>
<div class="item-subheader">
<div class="label">Services Offered:</div>
<div class="data service-offerings">
<?php
foreach($company['services_display'] as $service => $element){
print $element;
}
?>
</div>
</div>
<div class="item-body">
<div class="overview">
<div class="label">Cloud Providers:</div>
<div class="data">
<?php
foreach(array_slice($company['service_providers'], 0, 4) as $provider): ?>
<div>
<?php
print $provider;
?>
</div>
<?php endforeach; ?>
<div style="color:#000099;font-weight:bold;">Click</div>
</div>
</div>
<div class="details">
<?php
$str = '<div style="color:#000099;font-weight:bold;">Click</div>';
$result = preg_replace('(<style="color:#000099;font-weight:bold;">).*?(</div>)','$1$2',$str);
var_dump($result);
?>
<?php foreach(array_slice($company['service_providers'], 4) as $provider): ?>
<div>
<?php
print $provider;
?>
</div>
<?php endforeach; ?>
<?php print theme('cloud_computing_item_details', array('company' => $company)); ?>
</div>
</div>
<div style="clear: both; height: 5px;"> </div>
</div>
</div>
Upvotes: 1
Views: 118
Reputation: 8652
you cant do it, php is server side language, after the page loads you can only do this with javascript, for example, you can add an attribute
"onclick='remove(); return true;'"
to the button and put the function:
<script>
var remove=function(){
$('#ID_OF_BUTTON').hide(500);
}
</script>
that will do the work
Upvotes: 2