Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
What is a Model?
Models are PHP classes that are intended to work with data in your database. For instance, suppose you utilize CodeIgniter to deal with a blog. You may have a model class that contains capacities to embed, refresh, and recover your blog information. Here is a case of what such a model class may resemble:
Add Model
Create a Users_model.php file in application/models directory.
Inside the class create methods for data processing.
Create a
getUsers()
method to select all records from theuser_master
table and return an Array response.Loading a Model
Your models will typically be loaded and called from within your controller methods. To load a model you will use the following method:
$this->load->model('model_name');
CodeIgniter is an amazing PHP system with a little impression, worked for designers who require a straightforward and rich toolbox to make full-highlighted web applications.
Why should use CodeIgniter?
Blunder works in codeigniter are basic procedural interfaces that are accessible all inclusive all through the application, consequently the mistake messages are activated without thinking about the class/work scope.
CodeIgniter encourages us to report mistakes into our applications by utilizing the accompanying capacities:
show_error():
This capacity shows the mistake message utilizing the layout in application/blunders/error_general.php.
Syntax of show_error() function is:
show_error('message',status_code);
Here, the parameter message is required and is the string mistake message to be appeared and the parameter status_code is discretionary which is a whole number esteem speaking to the HTTP status code to be sent with the mistake.
Code Example:
show_error('File not found!');
show_404():
This capacity shows the 404 mistake message provided to it by the format in application/blunders/error_404.php.
Sentence structure of show_404() work is:
show_404('page'[,'log_error']);
The principal parameter page in show_404() work is the way of the page that isn’t found. By and large we can see that 404 messages are appeared by codeigniter naturally, if the controllers are not found.
The second parameter log_error is discretionary and has boolean esteem i.e. genuine or false. On the off chance that it is set to esteem false, codeigniter won’t log any show_404() calls and the other way around in the event that it is valid.
Code Example:
show_404('welcome.php');
log_message():
Everytime a page is run, a log document is produced. These log documents are under designer’s control.
This capacity enables you to compose messages in the log document.
Syntax of log_message() function is:
log_message('level','message');
The primary parameter level demonstrates which sort of blunder message you need to log. There are 3 dimensions of blunder message troubleshoot, mistake and data.The message is the second parameter.
Code Example:
log_message('error','username is unfilled');
Step 1:
Open the web browser.
Navigate to the web page you would like to get the source code.
Right click on the page and click “View page source”.
Step 2:
Alternatively, you can also use the keyboard shortcuts of CTRL + U on a PC to open a window with a site’s source code displayed.
On a Mac, this shortcut is Command + Alt + U
Google and other search engines couldn’t crawl iframe content. In some cases, once the robots entered the iframe, they couldn’t get out again, that means they didn’t index the content on the rest of the website either. But now google and most of the search engines’s web crawlers can usually travel freely between the website content and iframes.
<!DOCTYPE html>
<html>
<body>
<ol>
<li>Codeigniter</li>
<li>Wordpress</li>
<li>Magento</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<select>
<option value="PHP">PHP</option>
<option value="C">C</option>
<option value="JAVA">JAVA</option>
</select>
</body>
</html>
You can prevent form re-submission using a session variable.
Code:
<form action="" method="post">
<?php
$randnumber=rand();
$_SESSION['RANDNUMBER']=$randnumber;
?>
<input type="hidden" value="<?php echo $randnumber; ?>" name="checkNumber" />
<!-- The Rest of Fields will be goes here -->
<input type="submit" name="submit" value="submit" />
</form>
After check session variable $_SESSION[‘RANDNUMBER’] with textbox $_POST[‘checkNumber’] value Like
<?php
if(isset($_POST['submit']) && $_POST['checkNumber']==$_SESSION['RANDNUMBER'])
{
//Your Code will be goes here
}
?>
Indira Gandhi was the first woman Prime Minister of India
$storeId=Mage::app()->getStore()->getId();
//Multiple BCC email address
$add_bcc=array("user1@gmail.com","user2@gmail.com");
//Multiple CC email address
$add_cc=array("user3@gmail.com","user4@gmail.com");
$email='mail@domain.com';
$sender = Array('name' => 'test','email' => 'test@domain.com');
$mailSubject='Your subject here';
$vars = Array('name' => 'Your message');
$translate=Mage::getModel('core/email_template');
$translate->getMail()->addCc($add_cc);
$translate->setTemplateSubject($mailSubject)
->addBCC($add_bcc)
->sendTransactional($templateId, $sender, $email, null, $vars, $storeId);
$translate->setTranslateInline(true);
Download The Events Calendar plugin from here
Override & Create your Own template:
{1}Create “tribe-events” directory in your theme folder.
{2}Make a copy of the templates you want to customize.The template view files are located inside the plugin folder’s /src/views/ directory.
The Events Calendar template files:
/wp-content/plugins/the-events-calendar/src/views/
{3}Copy “default-template.php” the template and put inside [your-theme]/tribe-events/
{4}Update your custom template
{5}Finally change the setting from Events -> Settings -> Template -> Events Template.
default-template.php
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
get_header();
?>
<div id="tribe-events-pg-template" class="tribe-events-pg-template">
<?php tribe_events_before_html(); ?>
<?php tribe_get_view(); ?>
<?php tribe_events_after_html(); ?>
</div> <!-- #tribe-events-pg-template -->
<?php
get_footer();
**** Similar way you can change other templates as well but please make copy of that template and put inside [your-theme]/tribe-events/ .Otherwise it will lost when the plugin was updated .
To define a role in Magento 2
On the Admin panel, click System.Please Select “User Roles” under “Permissions” section
In the top upper-right corner, click “Add New Role” button.
In the Resource Access field, do the following
Set to Custom, then mark the checkbox of each website and view to which the role is to have permission to access.
Set to All if you want to mark all the checkbox
Finally click Save Role.
To define a role in Magento 2
On the Admin panel, click System.Please Select “User Roles” under “Permissions” section
In the top upper-right corner, click “Add New Role” button.
Under Roles Resources section please select as “Custom” and then check those modules that you want to get access for your users.
For accessing Blog Only please check the below select box options and finally select users from “Role Users” and click “Save Role” button in top corner.
Shop By Brand
—Manage Brands
——Edit Brand
——Save Brand
——Delete Brand
Blog
—Manage Posts
——Edit Post
——Save Post
——Delete Post
—Manage Comments
——Save Comment
——Delete Comment
—Manage Categories
——Edit Category
——Save Category
——Delete Category
Store Locator
—Manage Stores
MGS Panel
RAID:
LVM:
LVM stands for Logical Volume Manager that provides logical volume management for the Linux kernel.Applications use a virtual storage, which is managed using a volume management software, a Logical Volume Manager.This LVM hides the details about where data is stored, on which actual hardware and where on that hardware, from the entire system. Volume management lets you edit the storage configuration without actually changing anything on the hardware side, and vice versa. By hiding the hardware details it completely separates hardware and software storage management, so that it is possible to change the hardware side without the software ever noticing, all during runtime.With LVM no application has to be stopped any more due to change in the storage configuration and that’s why the system uptime can be enhanced significantly.
Size of LVM partition can be extended and reduced by using the commands.
Extend: lvextend
Reduce: lvreduce
vote_up
Try using the below code
SELECT CURRENT_DATE();
<?php
include "db.php";
$uid=$_REQUEST['uid'];
$data=array();
$sql=mysql_query("select * from tableName where user_id='$uid'");
while ($row=mysql_fetch_object($sql)){
$data[]=$row;
}
if(!empty($data)){
echo json_encode($data);
}else{
echo json_encode(false);
}
?>
#include<stdio.h>
int main() {
int a, b;
printf("\nEnter value for 1st number & 2nd number : ");
scanf("%d %d", &a, &b);
a = a + b;
b = a - b;
a = a - b;
printf("\nAfter swapping value of a : %d", a);
printf("\nAfter swapping value of b : %d", b);
return (0);
}
Program Output
Enter value for 1st number & 2nd number : 30 40
After swapping value of a : 40
After swapping value of b : 30