TOPIC:

Hide Div 1 year 2 months ago #244746

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
I would like to hide a div baseed on an if statement, however everything is inside a div.

I need to hide each label div based on if statement for each
{$items["header"]["value"]  = '<div style="display: table;background-color: #fa8201;  height: 35px; color: #ffffff;">

         <div style="display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">P</div>

         <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 310px;">TEAM NAME</div>

         <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 200px;">OWNER</div>

  
                     
<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;";>' .$label1 .'</div>
<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label2 .'</div>
   
<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 20px;">' .$label3 .'</div>
<div  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label4 .'</div>

<div if  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label5 .'</div>
<div if  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label6 .'</div>




<div if  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label7 .'</div>
<div if  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label8 .'</div>



<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 50px;">TOTAL</div>

         </div>';

Please Log in or Create an account to join the conversation.

Hide Div 1 year 2 months ago #244782

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
@Tihana

He has a custom setup to display cross-form values. The regular filter mechanisms wouldn't work here, that's why he asks for this.

@mrperfectpz

It would look something like this
{$items["header"]["value"]  = '<div style="display: table;background-color: #fa8201;  height: 35px; color: #ffffff;">;


if($statement){ // assuming if $statement is true and the below is what you actually mean by a label
{

$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">P</div>';
}

// continue like this with the rest


$items["header"]["value"]  .=  '</div>';

Regards,
Markus

Please Log in or Create an account to join the conversation.

Hide Div (solved) 1 year 2 months ago #244800

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
Hi Markus

Thanks for your reply on this but that doesnt seem to work yet. I only need to skip certain divs inside the overall div as your can see
{$items["header"]["value"]  = '<div style="display: table;background-color: #fa8201;  height: 35px; color: #ffffff;">

         <div style="display: table-cell;  font-family: Arial;font-size:14px;padding-bottom: 10px;padding-top: 7px;border: 5px solid transparent;min-width: 10px;">P</div>

         <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 310px;">TEAM NAME</div>

         <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 200px;">OWNER</div>;

  
if ($label1 >"") {$items["header"]["value"]  .= '<div style= "display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;";>' .$label1 .'</div>';}
if ($label2 >"") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label2 .'</div>';}
   
if ($label3 >"") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 20px;">' .$label3 .'</div>';}
if ($label4 >"") {$items["header"]["value"]  .= '<div  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label4 .'</div>';}

if ($label5 >"") {$items["header"]["value"]  .= '<div if  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label5 .'</div>';}
if ($label6 >"") {$items["header"]["value"]  .= '<div if  style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label6 .'</div>';}

             <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label7 .'</div>
             <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label8 .'</div>

              <div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 50px;">TOTAL</div>   


</div>';}

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

Hide Div 1 year 2 months ago #244805

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
well, you compare mathematically if a label is larger than an empty string:

if ($label3 >"")

this doesn't look right.

are you trying this maybe?

if ($label3 == "")

Please Log in or Create an account to join the conversation.

Hide Div 1 year 2 months ago #244812

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 411
  • Thanks: 0
Am I missing something here ?

If I remove the outside div it will work else I get this

"0 - syntax error, unexpected 'style' (T_STRING)"
$items["header"]["value"]  = '<div style="display: table;background-color: #fa8201;  height: 35px; color: #ffffff;">; 


if ($label1 >= "") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label1 .'</div>';}
if ($label2 >= "") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label2 .'</div>';}
   
if ($label3 >= "") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 20px;">' .$label3 .'</div>';}
if ($label4 >= "") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label4 .'</div>';}

if ($label5 >= "") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label5 .'</div>';}
if ($label6 >= "") {$items["header"]["value"]  .= '<div style="display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label6 .'</div>';}

$items["header"]["value"]  .= '<div style= "display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 10px;">' .$label7 .'</div>';
$items["header"]["value"]  .= '<div style= "display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 30px;">' .$label8 .'</div>';
$items["header"]["value"]  .= '<div style= "display: table-cell;  font-family: Arial;font-size:14px;border: 5px solid transparent;min-width: 50px;">TOTAL</div>';



</div>';}

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

Hide Div 1 year 2 months ago #244868

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 808
You probably didn't close the string with a quote when you removed it.

A little tip to make your life easier: get yourself a PHP editor with syntax check.
Then edit your editable code there, it will show you what went wrong and at what line number.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!