Jump to content

Search the Community

Showing results for tags 'combine'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. I have this html to let people select how how many color div wants to have from 1-3 <div class="color-side-a"> <p class="sideABCD-header">Side A</p> <div class="dimension-width"> <p class="dimension-WHC">Colors</p> <select name="number-of-colors" class="number-of-colors"> <option value="" group="1">Select A Number</option> <option value="1" group="1">1</option> <option value="2" group="1">2</option> <option value="3" group="1">3</option> </select> <div class="number-of-color-field"> <div name="color1" class="sideA color1"></div> <div name="color2" class="sideA color2"></div> <div name="color3" class="sideA color3"></div> </div> </div> </div><!-- end side A --> <div class="color-side-b"> <p class="sideABCD-header">Side B</p> <div class="dimension-width"> <p class="dimension-WHC">Colors</p> <select name="number-of-colors" class="number-of-colors"> <option value="" group="colors">Select A Number</option> <option value="1" group="colors">1</option> <option value="2" group="colors">2</option> <option value="3" group="colors">3</option> </select> <div class="number-of-color-field"> <div name="color1" class="sideB color1"></div> <div name="color2" class="sideB color2"></div> <div name="color3" class="sideB color3"></div> </div> </div> </div><!-- end side B --> I have this jquery to show /hide depend on the value chosen which is really just depend on value then show() /hide() the other divs which I didn't show since it's just simple something like value == 1, color1.show() color2.hide() and so on I have this function which then lets people pick the color they wanted in the selectColorBox div I know this code is duplicating but I tried a few ways and not sure how I can combine them in order to reuse most of the codes and if I have side C D E F G I wouldn't need to just copy and paste my codes var colorHolder = null; //used to store the location where color is picked <div class="color-side-a"> <p class="sideABCD-header">Side A</p> <div class="dimension-width"> <p class="dimension-WHC">Colors</p> <select name="number-of-colors" class="number-of-colors"> <option value="" group="1">Select A Number</option> <option value="1" group="1">1</option> <option value="2" group="1">2</option> <option value="3" group="1">3</option> </select> <div class="number-of-color-field"> <div name="color1" class="sideA color1"></div> <div name="color2" class="sideA color2"></div> <div name="color3" class="sideA color3"></div> </div> </div> </div><!-- end side A --> <div class="color-side-b"> <p class="sideABCD-header">Side B</p> <div class="dimension-width"> <p class="dimension-WHC">Colors</p> <select name="number-of-colors" class="number-of-colors"> <option value="" group="colors">Select A Number</option> <option value="1" group="colors">1</option> <option value="2" group="colors">2</option> <option value="3" group="colors">3</option> </select> <div class="number-of-color-field"> <div name="color1" class="sideB color1"></div> <div name="color2" class="sideB color2"></div> <div name="color3" class="sideB color3"></div> </div> </div> </div><!-- end side B --> this is my simple div box for user to pick colors <div class="colorSelectBox"> <div>Special</div> <div> <div class="pink" value="pink"></div> <div class="black" value="black"></div> <div class="yellow" value="yellow"></div> </div> <div class="clear"></div> <div>Original</div> <div> <div class="red"></div> <div class="blue"></div> <div class="grey"></div> <div class="green"></div> <div class="white"></div> </div> </div> how can I combine those two duplicated jquery into one function that I can further use more later if needed?
  2. I have the following code $fp = fopen('/output/report_sort.txt', 'w'); if(!$fp) die('Could not create / open text file for writing.'); if(fwrite($fp, $txt1) === false) die('Could not write to text file.'); // Print the totals for each category $data = file('/output/report_sort.txt', FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); usort($data, fn($a, $b)=>substr($a,11,2)<=>substr($b,11,2)); // sort by code number $codes = []; foreach ($data as $d) { $p = strpos($d, ')'); $k = substr($d, 11, $p-10); if (!isset($codes[$k])) { $codes[$k] = 1; } else { $codes[$k]++; } } //echo (join("<br>", $data)); echo ("<font color='blue'><b><h3>Total clicks</h3></b></font>"); foreach ($codes as $code => $total) { printf("%s <font color='red'><b>Total clicks = %d<br></b></font>", $code, $total); } echo "<br />"; which from this data 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Cartagena Murcia 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Nerja Malaga 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Cedar Springs Michigan 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Madrid Madrid 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 03 Resist the Curse (Resiste la Maldición) 11-12-2022.mp3 France 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 23 The Wedding Part 1 (La Boda) 30-7-2023.mp3 Ireland Dublin Leinster 22/09/2023 05 Day of Atonement 2023 (Día de la Expiación) 17-9-2023.mp3 Spain Nerja Malaga 22/09/2023 05 Day of Atonement 2023 (Día de la Expiación) 17-9-2023.mp3 Spain Cartagena Murcia outputs the totals for each category as follows 03 Resist the Curse (Resiste la Maldición) Total clicks = 2 04 Feast of Trumpets 2023 (Fiesta de las Trompetas) Total clicks = 19 05 Day of Atonement 2023 (Día de la Expiación) Total clicks = 32 06 Feast of Tabernacles 2023 (Fiesta de los Tabernáculos) Total clicks = 4 07 The Eighth Day 2023 (El Octavo Día) Total clicks = 17 19 The Bread of Life (El Pan de la Vida) Total clicks = 20 20 Be With Me Where I Am (Está Conmigo Donde Estoy) Total clicks = 4 20 The Legacy of Jesus (El Legado de Jesús) Total clicks = 2 23 The Wedding Part 1 (La Boda) Total clicks = 1 what I would like is to combine lines which are duplicated to show 1 line as 1 click as follows 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Cartagena Murcia 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Nerja Malaga 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Cedar Springs Michigan 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Madrid Madrid 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 03 Resist the Curse (Resiste la Maldición) 11-12-2022.mp3 France 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster To be shown in the totals as 03 Resist the Curse (Resiste la Maldición) Total clicks = 1 07 The Eighth Day 2023 (El Octavo Día) Total clicks = 1 the same for all the other categories
×
×
  • 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.