Jump to content

thara

Members
  • Content Count

    540
  • Joined

Community Reputation

5 Neutral

About thara

  • Rank
    Prolific Member
  • Birthday 02/05/1983

Profile Information

  • Gender
    Male
  • Location
    Panda

Contact Methods

  • Skype
    tharangagamage

Recent Profile Visitors

10,957 profile views
  1. I am trying to convert colors from Hex to HSL (Not HSL to Hex). I am using a PHP function for this purpose. But It's not working properly for some colors. For example for #e04c4c the HSL should be (0, 70%, 59%) which it isn't the case with the function. function hexToHsl($hex) { $red = hexdec(substr($hex, 0, 2)) / 255; $green = hexdec(substr($hex, 2, 2)) / 255; $blue = hexdec(substr($hex, 4, 2)) / 255; $cmin = min($red, $green, $blue); $cmax = max($red, $green, $blue); $delta = $cmax - $cmin; if ($delta === 0) { $hue = 0; } elseif ($cmax === $red)
  2. In my project I have a CSS custom variables like this: :root { --primary-color: #e04c4c; --secondary-color: #2c2c5e; --text-color: #d67900; } In my LESS files I have used LESS color functions to get more colors base on its primary and secondary. This is how its look like: .component1 { background: darken(--primary-color, 10%); } .component2 { background: lighten(--secondary-color, 5%); } But when I compile this, it gives an error like this? When googling I found a solution for SASS, but not for LESS. Can anybody tell me is there any possible worka
  3. Thanks for reply. Yes I tried it like that. Updated version: function seoUrl($string) { //Lower case everything $string = strtolower($string); //Make alphanumeric (removes all other characters) $string = preg_replace("/[^\pL\pN_\s-]/u", "", $string); //Clean up multiple dashes or whitespaces $string = preg_replace("/[\s-]+/", " ", $string); //Convert whitespaces and underscore to dash $string = preg_replace("/[\s_]/", "-", $string); return $string; } $title = seoUrl("this-is-a-දහසක්-බාධක-දුක්-කම්කටොලු-මැදින්-ලෝකය-දිනන්නට-වෙර-දරන"); echo $title; Output: t
  4. I need to create a SEO friendly string only from alphanumeric and characters of my native language. It is sinhala. My expected string should be something like this: $myString = "this-is-a-දහසක්-බාධක-දුක්-කම්කටොලු-මැදින්-ලෝකය-දිනන්නට-වෙර-දරන"; I am using a function to create the string like this. And that function is as follow: function seoUrl($string) { //Lower case everything $string = strtolower($string); //Make alphanumeric (removes all other characters) $string = preg_replace("/[^a-z0-9_\s-]/", "", $string); //Clean up multiple dashes or whitespaces
  5. Sir, I tried it in this way: //Insert other post image: if(!empty($_SESSION['other-image'])) { $record_vals = []; foreach ($other_image as $name => $values) { foreach ($values as $k => $v) { $record_vals[$k][$name] = $v; } } $query = "INSERT INTO post_image ( image_type , image , thumb , image_path , sort_order
  6. Yes sir. Its exactly what I needed. Now I want to insert these data into mysql. Sir, can you tell me how to do it? I tried it something like this, but it doesn't work. //Insert other post image: if(!empty($_SESSION['other-image'])) { $query = "INSERT INTO post_image ( image_type , image , thumb , image_path , sort_order , added_date
  7. This is my array. It has stored images data. [other-image] => Array ( [img] => Array ( [0] => 1526973657.jpg [1] => 1526973661.jpg [2] => 1526973665.jpg ) [path] => Array ( [0] => ../post-upload/1/ [1] => ../post-upload/1/ [2] => ../post-upload/1/ ) [type] => Array ( [0] => 1 [1] => 1 [2] => 1 ) [thumb] => Array ( [0] => thumb_1526973661.jpg
  8. mysql> SHOW VARIABLES LIKE '%char%'; +--------------------------+------------------------------------------------+ | Variable_name | Value | +--------------------------+------------------------------------------------+ | character_set_client | cp850 | | character_set_connection | cp850 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_se
  9. I am trying to insert data from my mother language (Sinhala) into my mysql table. But MySQL displays my chracters as question marks. This is how I test it: CREATE DATABASE sinhala_test; USE kindheart; ALTER DATABASE sinhala_test CHARACTER SET utf8 COLLATE utf8_general_ci CREATE TABLE IF NOT EXISTS `category` ( `category_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name_si` VARCHAR(100) COLLATE utf8_unicode_ci NOT NULL, `description_si` TEXT COLLATE utf8_unicode_ci NOT NULL, `last_update` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`category_id`) ) ENGINE=InnoDB DEFAULT CHARS
  10. I'm trying to add owl carousel for each bootstrap tab. Carousel in the first tab is loading perfectly, but when user clicks on second tab, owl carousel items are not loading. That mean on second tab it displays empty space instead of displaying carousel items. My HTML is something like this: <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#female" aria-controls="female" role="tab" data-toggle="tab">Female</a></li> <li role="presentation"><a href="#male" aria-controls="male"
  11. Welcome to PHPFreaks!
  12. Welcome to PHPFreaks!
  13. I too love Barand, I know, my contributions is over 100 likes for him. Congratulations Sir!!! Anyway anybody have a looked at this profile?
  14. Basically I am having an array something like below, this array has number of categories and sub, sub sub categories. $categories = array( array('id' => 1, 'parent' => 0, 'name' => 'Category'), array('id' => 2, 'parent' => 1, 'name' => 'Category A'), array('id' => 3, 'parent' => 1, 'name' => 'Category B'), array('id' => 4, 'parent' => 1, 'name' => 'Category C'), array('id' => 5, 'parent' => 1, 'name' => 'Category D'), array('id' => 6, 'parent' => 1, 'name' => 'Category E'), array('id' => 7, 'parent' =
  15. It doesn't matter. You can retrieve dates in whatever format you want Eg: SELECT DATE_FORMAT('2017-01-23', '%d/%m/%Y') But, you must however save all dates using the YYYY-MM-DD format as that is the only format that mysql date fields can accept (it is also the only format where you can sort into date order)..
×
×
  • 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.