01 November, 2018
public function insertblog()
{
$title = $this->input->post('title');
$author = $this->input->post('author');
$date = $this->input->post('date');
$description = $this->input->post('description');
$status = $this->input->post('status');
$images_count = count($_FILES['userfile']['name']);
$_FILES['image']['name'] = $_FILES['userfile']['name'];
$_FILES['image']['type'] = $_FILES['userfile']['type'];
$_FILES['image']['tmp_name'] = $_FILES['userfile']['tmp_name'];
$_FILES['image']['error'] = $_FILES['userfile']['error'];
$_FILES['image']['size'] = $_FILES['userfile']['size'];
$config['upload_path'] = 'uploads';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if($this->upload->do_upload('userfile')){
$data = array('upload_data' => $this->upload->data());
$img[] = $data['upload_data']['file_name'];
}
$product = array(
'title' => $title,
'author' => $author,
'date' => $date,
'description' => $description,
'status' => $status,
'image' => implode(",",$img),
);
if ($this->admin_blog_model->insertblog($product))
{
redirect('admin/all_blog');
}
else
{
redirect('admin/add_new_blog');
}
$this->admin_blog_model->insertblog($data);
$this->load->view('admin/edit_new_blog', $data);
redirect ('admin/add_new_blog');
}
29 October, 2018
PHP के Variables create करने से पहले उसके कुछ नियम समझे |
Programing Coderfunda
October 29, 2018
php
No comments
PHP के Variables create करने से पहले उसके कुछ नियम समझे |
Rules for PHP Variables
- PHP का variable बनाने के लिए शुरुआत में $ (dollar) sign का इस्तेमाल किया जाता है |
- $ sign के बाद variable underscore(_) या किसी भी letter(A-Z, a-z) से start किया जाता है | For eg. $var, $_var
- किसी भी numeric value से variable की शुरुआत नहीं होती | For eg. $123var
- Variable alphanumeric भी होता है | For eg. $var123
- PHP Language ये Variable के बारे में एक case-sensitive language है | यहाँ पर $a और $A ये दोनों अलग-अलग variables है |
Variable Initialization
Source Code :<?php $a = 2; //Integer $b = "c"; //Character $c = 2.5; //Double $d = "Hello"; //String $e = true; //Boolean $f = null; //NULL ?>
Variable ये एक data को store करने का माध्यम है | program पर सभी प्रकार के data types को store किया गया है
Output for above Example
Source Code :Output :<?php echo $a . "<br/>"; echo $b . "<br/>"; echo $c . "<br/>"; echo $d . "<br/>"; echo $e . "<br/>"; echo $f ; ?>
2 c 2.5 Hello 1
Variables Concatenation
PHP में एक variable को दुसरे variable के साथ जोड़ा जाता है |
Source Code :Output :<?php $var1 = "Hello"; $var2 = " World"; echo $var1 . $var2; echo $var1 . "Friends"; ?>
Hello WorldHelloFriends
Concatenation Variables with HTML Tags
Source Code :Output :<?php $var1 = "Hello"; $var2 = " World"; echo $var1 . $var2 . "<br />"; echo "<strong>" . $var1 . $var2 . "</strong>"; ?>
Hello World Hello World Variable Assigning Variable
यहाँ पर किसी variable की value किसी नए variable पर store की जा सकती है |
Source Code :Output :<?php $var1 = "Hello"; $var2 = " World"; $var3 = $var1; echo $var3; ?>
Hello
Variable की value को बदला जा सकता है |
Source Code :Output :<?php $var = "Hello World"; echo $var . "<br />"; $var = "Hello Friends"; echo $var . "<br />"; ?>
Hello World Hello Friends
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
Variable Scopes
PHP के Variable को कहा पर declare किया जाता है | पर variables को access करने के लिए तीन scopes बनाये गए है |
- Local Variable
- Global Variable
- Static Variable
1. Local Variable
Local Variables सिर्फ function के अन्दर ही accessible होते है |
Source Code :Output :<?php function func(){ $a = 10; echo "Value of a : $a"; } func(); //call function echo "Value of a : $a"; //not accessible from outside function ?>
Value of a : 10 Notice: Undefined variable: a in E:\xampp\htdocs\Variables.php on line 8 Value of a :
2. Global Variable
Global Variables; function के outside से access किये जाते है |
Source Code :Output :<?php $a = 10; function func(){ echo "Value of a : $a"; //not accessible from inside function } func(); //call function echo "Value of a : $a"; ?>
Notice: Undefined variable: a in E:\xampp\htdocs\Variables.php on line 4 Value of a : Value of a : 10
Variable Using global Keyword
Global Variables function के outside से access किये जाते है | लेकिन वो function के लिए accessible नहीं होते |
जब global keyword के साथ variables; function के अन्दर लिखे जाते है तो वो variables function के लिए भी accessible रहते है |
Source Code :Output :<?php $a = 2; $b = 4; function func(){ global $a, $b; } func(); echo "Value of a : $a <br />"; echo "Value of b : $b <br />"; ?>
Value of a : 2 Value of b : 4
3. Static Variable
Without Static Variable
जब function में बिना static variable का इस्तेमाल किया जाता है तो,
जब func() call किया जाता है, तब उसमे जो variables होते है, वो एक बार ही initialized होते है | उसके बाद वो destroy हो जाते है |
Source Code :Output :<?php function func(){ $a = 1; echo "Value of a : $a <br />"; $a++; } func(); func(); ?>
Value of a : 1 Value of a : 1
With Static Variable
जब function में static variable का इस्तेमाल किया जाता है तो,
जब func() call किया जाता है, तब उसमे जो variables होते है, वो अपनी values को hold करके रखते | ये variables destroyed नहीं होते |
Source Code :Output :<?php function func(){ static $a = 1; echo "Value of a : $a <br />"; $a++; } func(); func(); ?>
Value of a : 1 Value of a : 2
PHP के Variables create करने से पहले उसके कुछ नियम समझे |
Programing Coderfunda
October 29, 2018
php
No comments
PHP के Variables create करने से पहले उसके कुछ नियम समझे |
Rules for PHP Variables
- PHP का variable बनाने के लिए शुरुआत में $ (dollar) sign का इस्तेमाल किया जाता है |
- $ sign के बाद variable underscore(_) या किसी भी letter(A-Z, a-z) से start किया जाता है | For eg. $var, $_var
- किसी भी numeric value से variable की शुरुआत नहीं होती | For eg. $123var
- Variable alphanumeric भी होता है | For eg. $var123
- PHP Language ये Variable के बारे में एक case-sensitive language है | यहाँ पर $a और $A ये दोनों अलग-अलग variables है |
Variable Initialization
Source Code :<?php $a = 2; //Integer $b = "c"; //Character $c = 2.5; //Double $d = "Hello"; //String $e = true; //Boolean $f = null; //NULL ?>
Variable ये एक data को store करने का माध्यम है | program पर सभी प्रकार के data types को store किया गया है
Output for above Example
Source Code :Output :<?php echo $a . "<br/>"; echo $b . "<br/>"; echo $c . "<br/>"; echo $d . "<br/>"; echo $e . "<br/>"; echo $f ; ?>
2 c 2.5 Hello 1
Variables Concatenation
PHP में एक variable को दुसरे variable के साथ जोड़ा जाता है |
Source Code :Output :<?php $var1 = "Hello"; $var2 = " World"; echo $var1 . $var2; echo $var1 . "Friends"; ?>
Hello WorldHelloFriends
Concatenation Variables with HTML Tags
Source Code :Output :<?php $var1 = "Hello"; $var2 = " World"; echo $var1 . $var2 . "<br />"; echo "<strong>" . $var1 . $var2 . "</strong>"; ?>
Hello World Hello World
Variable Assigning Variable
यहाँ पर किसी variable की value किसी नए variable पर store की जा सकती है |
Source Code :Output :<?php $var1 = "Hello"; $var2 = " World"; $var3 = $var1; echo $var3; ?>
Hello
Variable की value को बदला जा सकता है |
Source Code :Output :<?php $var = "Hello World"; echo $var . "<br />"; $var = "Hello Friends"; echo $var . "<br />"; ?>
Hello World Hello Friends
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
Variable Scopes
PHP के Variable को कहा पर declare किया जाता है | पर variables को access करने के लिए तीन scopes बनाये गए है |
- Local Variable
- Global Variable
- Static Variable
1. Local Variable
Local Variables सिर्फ function के अन्दर ही accessible होते है |
Source Code :Output :<?php function func(){ $a = 10; echo "Value of a : $a"; } func(); //call function echo "Value of a : $a"; //not accessible from outside function ?>
Value of a : 10 Notice: Undefined variable: a in E:\xampp\htdocs\Variables.php on line 8 Value of a :
2. Global Variable
Global Variables; function के outside से access किये जाते है |
Source Code :Output :<?php $a = 10; function func(){ echo "Value of a : $a"; //not accessible from inside function } func(); //call function echo "Value of a : $a"; ?>
Notice: Undefined variable: a in E:\xampp\htdocs\Variables.php on line 4 Value of a : Value of a : 10
Variable Using global Keyword
Global Variables function के outside से access किये जाते है | लेकिन वो function के लिए accessible नहीं होते |
जब global keyword के साथ variables; function के अन्दर लिखे जाते है तो वो variables function के लिए भी accessible रहते है |
Source Code :Output :<?php $a = 2; $b = 4; function func(){ global $a, $b; } func(); echo "Value of a : $a <br />"; echo "Value of b : $b <br />"; ?>
Value of a : 2 Value of b : 4
3. Static Variable
Without Static Variable
जब function में बिना static variable का इस्तेमाल किया जाता है तो,
जब func() call किया जाता है, तब उसमे जो variables होते है, वो एक बार ही initialized होते है | उसके बाद वो destroy हो जाते है |
Source Code :Output :<?php function func(){ $a = 1; echo "Value of a : $a <br />"; $a++; } func(); func(); ?>
Value of a : 1 Value of a : 1
With Static Variable
जब function में static variable का इस्तेमाल किया जाता है तो,
जब func() call किया जाता है, तब उसमे जो variables होते है, वो अपनी values को hold करके रखते | ये variables destroyed नहीं होते |
Source Code :Output :<?php function func(){ static $a = 1; echo "Value of a : $a <br />"; $a++; } func(); func(); ?>
Value of a : 1 Value of a : 2
28 October, 2018
Bootstrap Grids
Programing Coderfunda
October 28, 2018
Bootstrap
No comments
Bootstrap Grid System
Bootstrap's grid system allows up to 12 columns across the page.
If you do not want to use all 12 columns individually, you can group the columns together to create wider columns:
| span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 |
| span 4 | span 4 | span 4 | |||||||||
| span 4 | span 8 | ||||||||||
| span 6 | span 6 | ||||||||||
| span 12 | |||||||||||
Bootstrap's grid system is responsive, and the columns will re-arrange automatically depending on the screen size.
Grid Classes
The Bootstrap grid system has four classes:
xs(for phones - screens less than 768px wide)sm(for tablets - screens equal to or greater than 768px wide)md(for small laptops - screens equal to or greater than 992px wide)lg(for laptops and desktops - screens equal to or greater than 1200px wide)
The classes above can be combined to create more dynamic and flexible layouts.
Basic Structure of a Bootstrap Grid
The following is a basic structure of a Bootstrap grid:
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
...
</div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
...
</div>
First; create a row (
<div class="row">). Then, add the desired number of columns (tags with appropriate .col-*-*classes). Note that numbers in .col-*-* should always add up to 12 for each row.Below we have collected some examples of basic Bootstrap grid layouts.
Bootstrap Grids
Programing Coderfunda
October 28, 2018
Bootstrap
No comments
Bootstrap Grid System
Bootstrap's grid system allows up to 12 columns across the page.
If you do not want to use all 12 columns individually, you can group the columns together to create wider columns:
| span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 | span 1 |
| span 4 | span 4 | span 4 | |||||||||
| span 4 | span 8 | ||||||||||
| span 6 | span 6 | ||||||||||
| span 12 | |||||||||||
Bootstrap's grid system is responsive, and the columns will re-arrange automatically depending on the screen size.
Grid Classes
The Bootstrap grid system has four classes:
xs(for phones - screens less than 768px wide)sm(for tablets - screens equal to or greater than 768px wide)md(for small laptops - screens equal to or greater than 992px wide)lg(for laptops and desktops - screens equal to or greater than 1200px wide)
The classes above can be combined to create more dynamic and flexible layouts.
Basic Structure of a Bootstrap Grid
The following is a basic structure of a Bootstrap grid:
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
...
</div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
...
</div>
First; create a row (
<div class="row">). Then, add the desired number of columns (tags with appropriate .col-*-*classes). Note that numbers in .col-*-* should always add up to 12 for each row.
Below we have collected some examples of basic Bootstrap grid layouts.