« Home « Chủ đề tự học php

Chủ đề : tự học php


Có 80+ tài liệu thuộc chủ đề "tự học php"

Tương tác giữa PHP và jQuery - part 6

tailieu.vn

To italicize all text in the paragraphs on the test page, use the following code:. .remove() and .detach(). To remove an element from the DOM entirely, the .remove() and .detach() methods are used. Both methods remove selected elements from the DOM, but the .detach() method keeps jQuery data for the element intact, which makes it ideal for situations in which...

Tương tác giữa PHP và jQuery - part 7

tailieu.vn

.height() and .width(). To obtain the height or width of an element, the .height() and .width() methods are handy. Both return a value without units, meaning the value returned is an integer (if the element is 68 pixels high,. Get the height of the form by running the following code:. console.log("Form height form").height()+"px");. This outputs the following in the console:....

Tương tác giữa PHP và jQuery - part 8

tailieu.vn

The .error() method allows developers to bind a handler (i.e., a function to be fired if the event occurs) to the event.. Create an image tag that tries to display an image that doesn’t exist, and attach an error handler to the error event that outputs a message to the console:. console.log("The image cannot be loaded!");. Upon execution of this...

Tương tác giữa PHP và jQuery - part 9

tailieu.vn

This results in the paragraph’s contents being replaced with new content from ajax.php (see Figure 2-23).. These defaults can be overwritten in subsequent calls to $.ajax() by simply redefining the option in the new call:. This results in the data being sent using GET (see Figure 2-24).. In a nutshell, these shorthand methods are simply wrapper functions that call $.ajax()...

Tương tác giữa PHP và jQuery - part 10

tailieu.vn

When working within a method, use $this in the same way you would use the object name outside the class.. To use these methods, call them just like regular functions, but first, reference the object to which they belong. echo $obj->getProperty. Set a new one echo $obj->getProperty. Get the value of $prop1 from both objects echo $obj->getProperty();. echo $obj2->getProperty();. $obj->setProperty("I'm...

Tương tác giữa PHP và jQuery - part 11

tailieu.vn

public function setProperty($newval). public function getProperty(). public function __construct(). ".<br />";. public function newMethod(). The class "MyClass". echo 'The class ". public function __destruct(). public function __toString(). In addition to its visibility, a method or property can be declared as static, which allows them to be accessed without an instantiation of the class.. Public Properties and Methods. This means that...

Tương tác giữa PHP và jQuery - part 12

tailieu.vn

immediately followed by the tag name and the value of the tag. @author: The author of the current element (which might be a class, file, method, or any bit of code) are listed using this tag. Multiple author tags can be used in the same DocBlock if more than one author is credited. The format for the author name is...

Tương tác giữa PHP và jQuery - part 13

tailieu.vn

index.php: This is the main file, which displays the month in calendar format with event titles displayed in the box of the day on which they occur.. view.php: If users clicks an event title, they’re taken to this page where the event’s data is displayed in detail.. admin.php: To create or modify new events, the form displayed on this page...

Tương tác giữa PHP và jQuery - part 14

tailieu.vn

This allows you to create a database object and pass it for use in the class easily.. To keep the database credentials separate from the rest of the application for easy maintenance, you want to use a configuration file. Create a new file called db-cred.inc.php in the config folder. (/sys/config/db-cred.inc.php). The database host URL. The database username. The database password....

Tương tác giữa PHP và jQuery - part 15

tailieu.vn

The event ID. The event title. The event description. $this->id = $event['event_id'];. $this->title = $event['event_title'];. $this->description = $event['event_desc'];. $this->start = $event['event_start'];. $this->end = $event['event_end'];. throw new Exception("No event data was supplied.");. Next, extract the day of the month from each event’s start date and add a new value to the array at that day’s index. In the Calendar class, create...

Tương tác giữa PHP và jQuery - part 16

tailieu.vn

Displaying Events in the Calendar. Adding the events to the calendar display is as easy as loading the events array from _createEventObj() and looping through the events stored in the index that matches the current day if any exist. Add event data to the calendar markup using the following bold code:. Determine the calendar month and create an array of...

Tương tác giữa PHP và jQuery - part 17

tailieu.vn

Because the markup generation is fairly simple when only using one event, all this method will do is load the desired event by its ID using _loadEventData() and then return the first—and only, due to the LIMIT 1 clause—result from the method.. Add the following method to the Calendar class:. @param int $id an event ID * @return object the...

Tương tác giữa PHP và jQuery - part 18

tailieu.vn

Creating a File to Display the Form. This file will be called admin.php, and it will reside in the root level of the public folder (/public/admin.php).. Similar to view.php, this file accomplishes the following:. Next, add the following inside the new admin.php file:. include_once '../sys/core/init.inc.php';. $css_files = array("style.css");. include_once 'assets/common/header.inc.php';. include_once 'assets/common/footer.inc.php';. After saving this code, navigate to http://localhost/admin.php to...

Tương tác giữa PHP và jQuery - part 19

tailieu.vn

Save this file, and then navigate to http://localhost/admin.php and create a new event with the following information:. After clicking the Create new event button, the calendar is updated with the new event (see Figure 5-3).. Adding a Button to the Main View to Create New Events. To make it easier for your authorized users to create new events, add a...

Tương tác giữa PHP và jQuery - part 20

tailieu.vn

To start, add a Delete button to the full view edit controls by modifying _adminEntryOptions() in the Calendar class with the code shown in bold:. Generates edit and delete options for a given event ID. @param int $id the event ID to generate options for * @return string the markup for the edit/delete options. <form action="admin.php". value="Edit This Event". name="event_id"....

Tương tác giữa PHP và jQuery - part 21

tailieu.vn

<form action="assets/inc/process.inc.php". include_once 'assets/common/footer.inc.php';. Save this code and navigate to http://localhost/login.php in your browser to see the resulting login form (see Figure 6-2).. In the class folder, create a new file called class.admin.inc.php (/sys/class/class.admin.inc.php). Now insert the following code into class.admin.inc.php to define the class, the property, and the constructor:. Determines the length of the salt to use in hashed...

Tương tác giữa PHP và jQuery - part 22

tailieu.vn

Load a hash of the word test and output it. echo "Hash 1 without a salt:<br />", $hash1, "<br /><br />";. Load a second hash of the word test. echo "Hash 2 without a salt:<br />", $hash2, "<br /><br />";. echo "Hash 3 with the salt from hash 2:<br />", $hash3;. You can learn more about this function at http://php.net/sleep....

Tương tác giữa PHP và jQuery - part 23

tailieu.vn

Modifying the App to Handle the User Logout. $actions array in process.inc.php. Insert the following bold code into process.inc.php to complete the logout process:. include_once '../../../sys/config/db-cred.inc.php';. Redirect to the main index if the token/action is invalid header("Location . '.inc.php';. Clicking the Log Out button removes the user data from the session. Note Now that you know the login is working,...

Tương tác giữa PHP và jQuery - part 24

tailieu.vn

231 include_once 'assets/common/footer.inc.php';. Now save this code and try to directly access http://localhost/confirmdelete.php while logged out.. As expected, you’ll be redirected to http://localhost/ instead.. In this chapter, you learned how to add user authorization to your calendar app, which means only authorized users can now make modifications to the calendar. In the next chapter, you’ll start integrating jQuery into the...

Tương tác giữa PHP và jQuery - part 25

tailieu.vn

class to the link $(this).addClass("active");. After saving this code, reload http://localhost/ in your browser and click any of the event titles.. Instead of going to the event details on view.php, the title of the event is output in the console. For instance, if you click the New Year's Day event, you will see the following output in the console:. Extracting...