Tag Archives: list

change color of list elements according to condition

Questions: I have two tables : Table 1 (overall Score ) Table 2 (weekly score ) I have a leaderboard where I am echoing the overall score value from Table 1 : Problem : What I am trying to do here is that whoever scores “-10” in table 2 (weekly score) , I want to… Read More »

Selecting default value in html dropdown list

Questions: I am currently looking to have a drop down list in my form. I have this drop down which selects the default value: <p>Price Band:<select id=’priceBand’ style = ‘width:150px’ value = ‘band1’> <option value=”band7″>Reduce by 30c</option> <option value=”band6″>Reduce by 25c</option> <option value=”band5″>Reduce by 20c</option> <option value=”band4″>Reduce by 15c</option> <option value=”band3″>Reduce by 10c</option> <option value=”band2″>Reduce… Read More »

Generating XML from HTML list using PHP

Questions: I would like to convert the list structure in html: <ul> <li>Section 1</li> <li>Section 2 <ul> <li>Section 2.1</li> <li>Section 2.2</li> </ul> </li> <li>Section 3</li> </ul> Into XML like this: <sections> <section> <caption>Section 1</caption> <level>0</level> </section> <section> <caption>Section 2</caption> <level>0</level> </section> <section> <caption>Section 2.1</caption> <level>1</level> </section> <section> <caption>Section 2.2</caption> <level>1</level> </section> <section> <caption>Section 3</caption> <level>0</level>… Read More »

MySQL sort by some list

Questions: I have a list of numbers: 7,1,3,2,123,55 (which are the ids of existing records) I have a mysql table with the colums id and name, where id is an integer primary key. I want to select records from this table, but in a specific order, for example 7,1,3,2,123,55. Is it possible to do this… Read More »

Call to undefined method Illuminate\Database\Query\Builder::lists() when seeding after updating to Laravel 5.3

Questions: I’m updating to laravel 5.3, and I get this message: [2016-08-23 23:12:39] local.ERROR: BadMethodCallException: Call to undefined method Illuminate\Database\Query\Builder::lists() in /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:2431 Stack trace: #0 [internal function]: Illuminate\Database\Query\Builder->__call(‘lists’, Array) #1 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1423): call_user_func_array(Array, Array) #2 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableTrait.php(254): Illuminate\Database\Eloquent\Builder->__call(‘lists’, Array) #3 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableTrait.php(170): App\User->getExistingSlugs(‘nouseratnouser-…’) #4 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableTrait.php(312): App\User->makeSlugUnique(‘nouseratnouser-…’) #5 /home/vagrant/Code/vendor/cviebrock/eloquent-sluggable/src/SluggableServiceProvider.php(72): App\User->sluggify() #6 [internal function]: Cviebrock\EloquentSluggable\SluggableServiceProvider->Cviebrock\EloquentSluggable\{closure}(Object(App\User)) #7 /home/vagrant/Code/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(221): call_user_func_array(Object(Closure), Array) #8… Read More »

Use RecursiveDirectoryIterator to list directories and files into array?

Questions: I’m having a directory with this structure : main/ |- images/ |– file1.jpg |– file2.jpg |– file3.jpg |- documents/ |– private/ |— blahblahblah.docx |– test.doc |– test.xls |– test.txt I can create a function to complete the work but the RecursiveDirectoryIterator class is much faster and less memory usage this time. How can I… Read More »