Tuesday, August 29, 2017

Detect the url and filter the url and hide some id which we do not need

var $ = jQuery.noConflict();
  $(document).ready(function() {
   var url = window.location.href;
     var a = window.location.pathname;
       c = a.substring(1);
       //console.log(c);
       if(c==''||c=='bienvenue-langue'||c=='bienvenue'||c=='welcome'){
       //console.log('need to remove header section');
       $('#header-block').css("cssText", "display:none !important;");
       $('#top-b').css("cssText", "display:none !important;");
       }
     
  //$('#maininner').css("cssText", "min-height: 1400px !important;");
 });

Wednesday, June 28, 2017

string limit laravel

{{{str_limit($yourString,9)}}}

Tuesday, June 27, 2017

how to upload image in laravel


in main function

if (Input::hasFile('image'))
{
  $getUpload = $this->uploadFile($imageNameWanted);
  if($getUpload){
  $UpdateProductImage = PackProduct::find($productId)->update(array('image' =>$imageNameWanted));
  }
  else {
  return Redirect::back()->withErrors('Wrong format of image file')->withInput();;
  }
}



use this function in main function
public function uploadFile($imageNameWanted)
{
        $destinationPath=base_path().'/public/awesome-assets/img/pdfs/';
$uploadResult = Input::file('image')->move($destinationPath,$imageNameWanted);
if($uploadResult)
{
return true;
}
else {
  return false;
}
}

Monday, June 19, 2017

Short relationship in laravel



In usersubscription model

class UserSubscription extends Ardent {
use SoftDeletingTrait;

protected $softDelete = true;
protected $dates = ['deleted_at'];

  public static $rules = array(
    'user_id'               => 'required|numeric',
    'order_id'              => 'numeric',
    'product_id'            => 'numeric',
    'currency'             => 'required',
    'shipping_amount'       => 'required|numeric',
    'net_amount'            => 'required|numeric',
    'pst_amount'            => 'required|numeric',
    'gst_amount'            => 'required|numeric',
    'discount_amount'       => 'numeric',
    'total_amount'          => 'required|numeric',
    'start_date'            => 'required|date',
    'next_date'             => 'required|date',
    'last_date'             => 'date',
    'end_date'             => 'date',
    'completed_orders'     => '',
    'repeat_unit_type'     => '',
    'repeat_every_x_units' => 'numeric',
    'is_active'             => 'required|in:0,1',
    'number_of_attempts' => 'numeric',
    'last_error_text' => '',
    'cancellation_reason_id'=> '',
    'custom_cancellation_reason'=> '',
  );

  public function cancellationReason()
  {
    return $this->belongsTo('CancellationReason', 'cancellation_reason_id');
  }
//END OF  Usersubscription model


// BEGIN OF CANCELLATION REASON MODEL

class CancellationReason extends Eloquent {
use SoftDeletingTrait;

protected $softDelete = true;
protected $dates = ['deleted_at'];

  public static $rules = array(
    'reason'            => 'required',
    'has_custom_text'     => '',
  );

  protected $fillable = array(
    'reason',
    'has_custom_text',
  );

  public function userSubscriptions()
  {
    return $this->hasMany('UserSubscription');
  }

/**
* Model bootstrap
*/
public static function boot()
  {
    // make the parent (Eloquent) boot method run
    parent::boot();  
  }

}

///// How to use it in view

@if($subscription->cancellationReason)
  {{$subscription->cancellationReason->reason}}
@endif


Tuesday, June 13, 2017

Needed component

needed component


how to create theme in joomla

https://code.tutsplus.com/tutorials/how-to-build-a-joomla-template-start-to-finish--net-15511

How do you add a new module position?

Inserting the code

  • Open the index.php file of the Template you wish to edit
  • Locate the place in the Template where you wish to put the new position.
  • Insert
<jdoc:include type="modules" name="newposition"   />
  • The variable can be used (between existing tags) to replace an image by replacing the <img src="xxx" border="0" alt="">. Or By creating a new tag with its own class/id.
  • Open the Template's TemplateDetails.xml file and locate the
<positions></positions> Start and end tags 
  • Then add
<position>newposition</position>
  • Example
<positions>
  <position>debug</position>
  <position>position-0</position>
  <position>position-1</position>
  <position>position-2</position>
  <position>position-3</position>
  <position>position-4</position>
  <position>position-5</position>
  <position>position-6</position>
  <position>position-7</position>
  <position>position-8</position>
  <position>position-9</position>
  <position>position-10</position>
  <position>position-11</position>
  <position>position-12</position>
  <position>position-13</position>
  <position>position-14</position>
  <position>position-15</position>
  <position>newposition</position>
</positions>

https://docs.joomla.org/How_do_you_add_a_new_module_position%3F

How to display horizontally menu in protostar Joomla template

 protostar template
want to display the main menu at the navigation section
go to the module and change the position at the right position

then go the menu assigement section and add class ' nav-pills' into the class

It will shows the pills menus.

Friday, June 9, 2017

how to reset joomla password

  1. Find your admin user and click on Edit.
    Admin Password Reset
  2. Copy d2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199 into the password field and click on Go.
     3.use 'secret' as password  and username is:libing

How to include custom js code in joomla


/layouts/template.php in your template

 <?php
  // bing add this 20170609
   $document = JFactory::getDocument();
   $document->addScript('templates/fontaine_j3/js/custom.js');
  ?>

custom.js code

/* Bing added it in 20170421 to get horizontal display */
var $ = jQuery.noConflict();
  $(document).ready(function() {
    window.onload = function () {
    $('#toTop').css("cssText", "text-transform: none !important;");
     $('#toTop').text('Retour en haut');
     // console.log('set the value to it');
    }
 });

Monday, June 5, 2017

Custom module

two ways to use module
{loadposition my_address}
{module address}



create custom module
select position as "my_address"
title is address.

How to include article in module
{article 304}[text]{/article}

{loadmodule mod_login,Login Form}

Friday, May 19, 2017

window.onload


var $ = jQuery.noConflict();
jQuery(document).ready(function ($) {
  window.onload = function () {
    setTimeout(function () {
    var windowsize = $(window).width();
       //alert(windowsize);
       if (windowsize < 1100 && windowsize >1000) {
       // if the window is greater than 1021 wide  and less than 1025then turn on jScrollPane..
       $('#engine_box .gbTab_holder li').css("cssText", "width: 15% !important;");
        console.log('by default change the tab width');
      }
      else {
       $('#engine_box .gbTab_holder li').css("width","");
       console.log('set to default width then it is not ipad pro by defauly');
      }
    $(window).resize(function() {
      windowsize = $(window).width();
     // alert('changed screen');
      if (windowsize < 1100 && windowsize > 1000) {
        // if the window is greater than 1021 wide  and less than 1025then turn on jScrollPane..
           $('#engine_box .gbTab_holder li').css("cssText", "width: 15% !important;");
           console.log('changed screen  after change the tab width');
      }
      else {
          $('#engine_box .gbTab_holder li').css("width","");
          console.log('set to default width then it is not ipad pro by defauly');
      }
    });

   
    }, 4000);

  };

});

Tuesday, May 2, 2017

        <?php
  echo '<pre>';
  echo $userMember;
    echo '</pre>';
echo $userMember->user;
         echo '<br> this is one';
echo $userMember->relationship;
echo '<br> this is second';
echo $userMember->metas;

?>

Sunday, April 30, 2017

Debug

error_reporting(E_ALL);
ini_set("display_errors", 1);
include("function.php");

Saturday, April 29, 2017

SMTP connect() failed Solution: change to $mail->isMail() instead of isSMTP()

SMTP connect() failed Solution: change to $mail->isMail() instead of isSMTP()

ob_start to include file

         ob_start ();
         include 'email_template/'.$pdf_card[$choose_template];
         $output = ob_get_contents ();
         ob_end_clean ();

Thursday, April 27, 2017

  1. 1. Log into your Joomla 3.0 administrative dashboard
  2. 2. In the top menu, click Extensions and then click Template Manager
  3. 3. In the tabs at the top of the page, click the Options tab
  4. 4. Under the Templates tab, find the following setting:

    Preview Module Positions
    Enable the preview of the module positions in the template by appending tp=1 to the web address. Also enables the Preview button in the list of templates. Please refresh the page after changing this setting.

    Click Enabled next to this option, and then click the Save & Close button at the top of the page.
  5. 5. Once again, in the top menu, click Extensions and then click Template Manager
  6. 6. Now that we have the Preview Module Positions setting enabled, you will see a preview icon next to your Site Templates. Click the preview icon next to the template you would like to view.
    preview-icon-next-to-modules
  7. 7. After clicking the preview icon, you'll see a new window appear that looks similar to the below (we are previewing the prostart template):
    viewing-module-positions
    As you can see in the screenshot above, the red arrow points to position-7. If you wanted a module to show in this position, you would assign the module to position-7.
How to  using  custom module:
{loadposition nameofmodule}

Tuesday, April 4, 2017

SQL quiz

W3Schools SQL Quiz

SQL QUIZPoints: 24 out of 25
1. What does SQL stand for?
You answered:
Structured Query Language
 Correct Answer!

2. Which SQL statement is used to extract data from a database?
You answered:
SELECT
 Correct Answer!

3. Which SQL statement is used to update data in a database?
You answered:
UPDATE
 Correct Answer!

4. Which SQL statement is used to delete data from a database?
You answered:
DELETE
 Correct Answer!

5. Which SQL statement is used to insert new data in a database?
You answered:
INSERT INTO
 Correct Answer!

6. With SQL, how do you select a column named "FirstName" from a table named "Persons"?
You answered:
SELECT FirstName FROM Persons
 Correct Answer!

7. With SQL, how do you select all the columns from a table named "Persons"?
You answered:
SELECT * FROM Persons
 Correct Answer!

8. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
You answered:
SELECT * FROM Persons WHERE FirstName='Peter'
 Correct Answer!

9. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?
You answered:
SELECT * FROM Persons WHERE FirstName LIKE 'a%'
 Correct Answer!

10. The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true
You answered:
True
 Correct Answer!

11. With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?
You answered:
SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
 Correct Answer!

12. With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?
You answered:
SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
 Correct Answer!

13. Which SQL statement is used to return only different values?
You answered:
SELECT DISTINCT
 Correct Answer!

14. Which SQL keyword is used to sort the result-set?
You answered:
ORDER BY
 Correct Answer!

15. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
You answered:
SELECT * FROM Persons ORDER BY FirstName DESC
 Correct Answer!

16. With SQL, how can you insert a new record into the "Persons" table?
You answered:
INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
 Correct Answer!

17. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
You answered:
INSERT INTO Persons (LastName) VALUES ('Olsen')
 Correct Answer!

18. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
You answered:
UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'
 Correct Answer!

19. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?
You answered:
DELETE FROM Persons WHERE FirstName = 'Peter'
 Correct Answer!

20. With SQL, how can you return the number of records in the "Persons" table?
You answered:
SELECT COUNT() FROM Persons
 Wrong Answer!

21. What is the most common type of join?
You answered:
INNER JOIN
 Correct Answer!

22. Which operator is used to select values within a range?
You answered:
BETWEEN
 Correct Answer!

23. The NOT NULL constraint enforces a column to not accept null values.
You answered:
True
 Correct Answer!

24. Which operator is used to search for a specified pattern in a column?
You answered:
LIKE
 Correct Answer!

25. Which SQL statement is used to create a table in a database?
You answered:
CREATE TABLE
 Correct Answer!

JavaScript Quiz

W3Schools JavaScript Quiz

JavaScript QUIZPoints: 21 out of 25
1. Inside which HTML element do we put the JavaScript?
You answered:
<script>
 Correct Answer!

2. What is the correct JavaScript syntax to change the content of the HTML element below?


<p id="demo">This is a demonstration.</p>
You answered:
document.getElementById("demo").innerHTML = "Hello World!";
 Correct Answer!

3. Where is the correct place to insert a JavaScript?
You answered:
Both the <head> section and the <body> section are correct
 Correct Answer!

4. What is the correct syntax for referring to an external script called "xxx.js"?
You answered:
<script src="xxx.js">
 Correct Answer!

5. The external JavaScript file must contain the <script> tag.
You answered:
False
 Correct Answer!

6. How do you write "Hello World" in an alert box?
You answered:
alert("Hello World");
 Correct Answer!

7. How do you create a function in JavaScript?
You answered:
function myFunction()
 Correct Answer!

8. How do you call a function named "myFunction"?
You answered:
myFunction()
 Correct Answer!

9. How to write an IF statement in JavaScript?
You answered:
if (i == 5)
 Correct Answer!

10. How to write an IF statement for executing some code if "i" is NOT equal to 5?
You answered:
if (i != 5)
 Correct Answer!

11. How does a WHILE loop start?
You answered:
while (i <= 10)
 Correct Answer!

12. How does a FOR loop start?
You answered:
for (i = 0; i <= 5; i++)
 Correct Answer!

13. How can you add a comment in a JavaScript?
You answered:
//This is a comment
 Correct Answer!

14. How to insert a comment that has more than one line?
You answered:
/*This comment has
more than one line*/
 Correct Answer!

15. What is the correct way to write a JavaScript array?
You answered:
 Wrong Answer!

16. How do you round the number 7.25, to the nearest integer?
You answered:
Math.round(7.25)
 Correct Answer!

17. How do you find the number with the highest value of x and y?
You answered:
Math.max(x, y)
 Correct Answer!

18. What is the correct JavaScript syntax for opening a new window called "w2" ?
You answered:
w2 = window.new("http://www.w3schools.com");
 Wrong Answer!

19. JavaScript is the same as Java.
You answered:
True
 Wrong Answer!

20. How can you detect the client's browser name?
You answered:
browser.name
 Wrong Answer!

21. Which event occurs when the user clicks on an HTML element?
You answered:
onclick
 Correct Answer!

22. How do you declare a JavaScript variable?
You answered:
var carName;
 Correct Answer!

23. Which operator is used to assign a value to a variable?
You answered:
=
 Correct Answer!

24. What will the following code return: Boolean(10 > 9)
You answered:
true
 Correct Answer!

25. Is JavaScript case-sensitive?
You answered:
Yes
 Correct Answer!

Bootstrap Quiz

W3Schools Bootstrap Quiz

Bootstrap QUIZPoints: 18 out of 25
1. Bootstrap 3 is mobile-first.
You answered:
True
 Correct Answer!

2. Which class provides a responsive fixed width container?
You answered:
.container-fixed
 Wrong Answer!

3. Which class provides a full width container, spanning the entire width of the viewport?
You answered:
.container
 Wrong Answer!

4. The Bootstrap grid system is based on how many columns?
You answered:
12
 Correct Answer!

5. Which class adds zebra-stripes to a table?
You answered:
.table-zebra
 Wrong Answer!

6. Which class shapes an image to a circle?
You answered:
.img-circle
 Correct Answer!

7. Which class is used to create a big box for calling extra attention?
You answered:
.jumbotron
 Correct Answer!

8. Which button class is used to create a large button?
You answered:
.btn-lg
 Correct Answer!

9. Which class is used to create a button group?
You answered:
.btn-group
 Correct Answer!

10. How can you insert a search icon?
You answered:
<span class="glyph glyph-search"></span>
 Wrong Answer!

11. Which class is used to create a badge?
You answered:
.badge
 Correct Answer!

12. Which class is used to create a basic pagination?
You answered:
.pagination
 Correct Answer!

13. Which class is used to create a basic list group?
You answered:
.list-group
 Correct Answer!

14. Which class adds a heading to a panel?
You answered:
.panel-head
 Wrong Answer!

15. Which class indicates a dropdown menu?
You answered:
.dropdown
 Correct Answer!

16. A standard navigation tab is created with:
You answered:
<ul class="nav nav-navbar">
 Wrong Answer!

17. A standard navigation bar is created with:
You answered:
<nav class="navbar navbar-default">
 Correct Answer!

18. Which class is used to create a black navigation bar?
You answered:
.navbar-black
 Wrong Answer!

19. Which plugin is used to cycle through elements, like a slideshow?
You answered:
Carousel
 Correct Answer!

20. Which plugin is used to create a modal window?
You answered:
Modal
 Correct Answer!

21. Which plugin is used to create a tooltip?
You answered:
Tooltip
 Correct Answer!

22. Which contextual class indicates a succesful or positive action?
You answered:
.text-success
 Correct Answer!

23. Which contextual class indicates a dangerous or potentially negative action?
You answered:
.text-danger
 Correct Answer!

24. Which class indicates uppercased text?
You answered:
.text-uppercase
 Correct Answer!

25. The Bootstrap grid system works across multiple devices.
You answered:
True
 Correct Answer!


By W3SchoolsTime spent: 5:05 

PHP Quiz in W3schools

W3Schools PHP Quiz

PHP QUIZPoints: 19 out of 25
1. What does PHP stand for?
You answered:
Personal Hypertext Processor
 Wrong Answer!

2. PHP server scripts are surrounded by delimiters, which?
You answered:
<?php...?>
 Correct Answer!

3. How do you write "Hello World" in PHP
You answered:
echo "Hello World";
 Correct Answer!

4. All variables in PHP start with which symbol?
You answered:
$
 Correct Answer!

5. What is the correct way to end a PHP statement?
You answered:
;
 Correct Answer!

6. The PHP syntax is most similar to:
You answered:
Perl and C
 Correct Answer!

7. How do you get information from a form that is submitted using the "get" method?
You answered:
$_GET[];
 Correct Answer!

8. When using the POST method, variables are displayed in the URL:
You answered:
False
 Correct Answer!

9. In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
You answered:
True
 Correct Answer!

10. Include files must have the file extension ".inc"
You answered:
False
 Correct Answer!

11. What is the correct way to include the file "time.inc" ?
You answered:
<?php include "time.inc"; ?>
 Correct Answer!

12. What is the correct way to create a function in PHP?
You answered:
function myFunction()
 Correct Answer!

13. What is the correct way to open the file "time.txt" as readable?
You answered:
fopen("time.txt","r");
 Correct Answer!

14. PHP allows you to send emails directly from a script
You answered:
False
 Wrong Answer!

15. Which superglobal variable holds information about headers, paths, and script locations?
You answered:
$_SERVER
 Correct Answer!

16. What is the correct way to add 1 to the $count variable?
You answered:
$count =+1
 Wrong Answer!

17. What is a correct way to add a comment in PHP?
You answered:
/*...*/
 Correct Answer!

18. PHP can be run on Microsoft Windows IIS(Internet Information Server):
You answered:
False
 Wrong Answer!

19. The die() and exit() functions do the exact same thing.
You answered:
False
 Wrong Answer!

20. Which one of these variables has an illegal name?
You answered:
$my-Var
 Correct Answer!

21. The setcookie() function must appear BEFORE the <html> tag.
You answered:
True
 Correct Answer!

22. In PHP, the only way to output text is with echo.
You answered:
False
 Correct Answer!

23. How do you create an array in PHP?
You answered:
$cars = array("Volvo", "BMW", "Toyota");
 Correct Answer!

24. The if statement is used to execute some code only if a specified condition is true
You answered:
False
 Wrong Answer!

25. Which operator is used to check if two values are equal and of same data type?
You answered:
===
 Correct Answer!