Use EaglePHP to build your own website (non-PHP programmer's cainiao User Manual)

Source: Internet
Author: User
Tags mysql command line

This article is almost the same as that on my blog website, and the articles on my website will be updated continuously. If you need to check the latest content, go to my website. (I am too tired to update 2 parts)

Modify eaglePHP to form my current website. The address of my website can be compared with the difference between the modification and my website. Another website ):

In the previous article, the installation and configuration of Apache2.2 + MySql5.5 + PHP5.4 (windows) talked about how to configure the php environment. This article describes how to use the open source php Architecture --- eaglephp.

This article introduces how to use open-source Blog Code

1. First, log on to http://www.eaglephp.com/pub/download source code (in the upper right corner). As of my download, the latest version is v2.0,

We will install eaglephp again!

2. Import the database to MySQL

After everything is configured, enter localhost in the browser and the installation wizard will appear. Enter the correct mysql username (the root administrator username is used by default and can be created by ourselves) and password.

[Advanced:

In case of an accident, you want to reinstall (or the website crashed, but you saved the database. SQL file, if it is compressed and decompressed, you can also obtain eaglephp. SQL file), you can delete the install under EaglePHP2.0 \ Data \ _ INSTALL. LOCK file, eaglephp will guide you to reinstall! In this case, you may encounter another problem, that is, if you choose to add a table prefix such as eag _ during installation _. There are two methods, but you can still choose one.

Method 1. During installation, you can choose not to add the table prefix (leave this item empty ). Install the EaglePHP2.0 \ Conf file. change 'dbprefix' => ''To 'dbprefix' => 'eag _ 'in the PHP file to reload the server, so that the website can operate again.

Method 2. during installation, you still select to add the same prefix, such as eag _. After installation, go to phpmyadmin and click eagle database to select all tables, modify the table prefix for the selected items (these options are at the bottom of the page) and change eag_eag _ to eag _ to reload.]

[Advanced:

MySQL command line operation (for emergency needs)

Locate MySQL 5.5 Command Line Client.exe at the beginning

Mysql> dropdatabase eaglephp; // Delete the original eaglephp database. This is not required for the first installation.

Mysql> createdatabase eaglephp; // create a new database

Mysql> useeaglephp; // enter the database and be sure to write this sentence.

Myslq> source I: \ EaglePHP \ Pub \ install \ data \ eaglephp. SQL

(This folder may not exist, but the EaglePHP. SQL file is bound to be in the eaglephp folder)

// Import the database file content

At this time, the data is imported. If it fails, disable it and re-import it! (I must do this here) then go to the C: \ ProgramData \ MySQL \ MySQLServer 5.5 \ data \ eaglephp folder to see the imported data !]

If no problem exists before, enter localhost in the browser and the EaglePHP page appears. After getting familiar with it, we will log on to the background!

The user name is admin and the password is 123456. Another user name guset and password 123456 correspond to the visitor. Naturally, we need to change the admin password after going in! (Click "Change Password" in the upper right corner !")

First, familiarize yourself with this background management page, which is called CMS background management. On the one hand, it is indeed powerful, and on the other hand, it is also complex. Okay. Let's take a look at the important functions!

Obviously, "Add news", "add category", and "album management" are some common functions. Let's start using them one by one to see the effect!

(1) Add news

Enter the title and content, and click Add in the lower right corner! You must select "type". When fields are missing, eaglePHP is marked in red, which is convenient. Select either of them and find an error. The error may be described as [16:40:34] SQL [256] Field 'img 'doesn' t have a default value [SQL]: insert into 'new' ('title', 'type', 'rank ', 'auth', 'source', 'clicknum ....

That is to say, the img field cannot be blank. This is caused by the mysql version (the mysql version developed by boss is 5.5.16 and my version is 5.5.20). You can set the img field to be empty. We have to go to database modification. Open phpMyAdmin (the previous article explains how to install it), click the news table (there may be an eag _ header, you should be able to recognize it), click the structure above, and click Modify, pull the pop-up box to the right, find the "null" check box, tick it, and save it.

At this time, you must be eager to see whether the webpage is updated, but the F5 has not changed after refreshing, in this case, you need to select "Application Center"> "System Management"> "cache Update"> "Clear cache count" (the word "data" is missing) in the background system ). Refresh the page again, and a new article will appear on the homepage and corresponding page!

Add image:

You can add images in eaglePHP only by means of connection, to save the size. However, you can save the image to the clipboard and paste it directly to the document for display. As we all know, the screenshot function of QQ is good. (If ctrl + v doesn't work, right-click and paste it, depending on whether the browser supports it.) The following describes how to add a part in detail. As of now (eaglePHP2.0), the first image must be uploaded, instead, you cannot import images by copying and pasting the memory.

Find the image control in the control window and Click Upload

Click "add File". jpg, jpeg, gif, and pgn formats are supported. All images are compressed to save network space. We recommend that you use a jpg file, which is generally smaller than a png image. (Images in this article are also in jpg format)

After adding several files, click Start upload. The image will be uploaded and displayed in order. We will extract the first image as a thumbnail!

After clearing the cache, let's take a look:

Sure enough, the thumbnail display is good, although it is a static image, but it is already very good. It is useless even if you upload a dynamic image gif as a thumbnail. However, if a gif dynamic image is not used as a thumbnail, it can be displayed properly. It indicates that currently, eaglePHP does not have a complete GIF image that supports thumbnails.

After refreshing the cache, we open the page that just added the image and find an additional icon.

Here we should see that eaglePHP is not properly handled. We can modify the article to delete the unloaded image without affecting the display of the thumbnail.

Add a summary for the image: it is best to upload the image through the control! If you use the screenshot function of qq to add images, but cannot be the first image, adding such images will occupy a lot of space and is not recommended. (Learn more about image processing)

(2) Add a video

Open a youku video, click the lower triangle on the left side of the favorites folder, view the flash Address, and click Copy. The address is copied to the clipboard of the system.

Enter the eaglePHP file for editing: Press ctrlw.vto fill in the address, and the last extension name is .swf

Then we can see that the video is loaded!

If you want to delete the file, press the Backspace key to delete it. If you cannot delete the file, you can add or modify the file before opening the file and press Backspace, which is as simple as editing text in word.

If you want to see the effect, remember to clear the cache ~

(3) add images

To add an image, you must first "add album". After adding the album, you can upload the image. You can upload multiple images at a time, you should know how to select multiple files.) You can also add files one by one and click "Upload" to transfer the images to this album. After the image is uploaded, you can see it without clearing the cache. The eaglePHP image display effect is very beautiful!

(4) Advertising Management

Advertisement Management corresponds to the ever-changing pictures at the top of the homepage. Obviously, this is the most important part of the website. EaglePHP supports image display. You can click an image to jump to another link. You can delete these ads or temporarily disable them from being displayed. These options are really good. As for how to connect to my website page, I haven't tried it yet. When my website goes online and has my own domain name, I will try it.

(5) Comment management

Here, you can manage the replies sent by netizens to any of your articles in a unified manner, and record the latest replies. Of course, only text replies are supported, but it is very convenient! After replying as an administrator, you can directly refresh the page without clearing the cache. What is more powerful here is that we can modify the text replied by others in the CMS background management, or view the author's email address and other content. Although the reply is easy for website administrators to see the latest reply, eaglePHP does not yet provide this function for online users who find that the website master has replied to their own messages. I think you can send him an email by default. If he doesn't want to know whether there is a reply, you can give him a fake email address.

(6) Music Management

At present, it is difficult to find many music files (the full link address cannot be found). If you want to add music files, you can apply for an online disk in some free space and store the songs, you can get the link to the song! EaglePHP to the example is to apply for a space in the http://s1.mjbox.com, then upload a few songs up, and then get the external chain, but the external chain time is only about a week, it is easy to expire.

After trying, I found that http://www.airsina.net/webupload/is still incorrect, and the external chain of the code can be kept for 3 months. But there is something more powerful!

That is windows live, but it also needs 5 ~ 10 minutes of study time, http://tieba.baidu.com/p/1735575571 (or my connection http://blog.csdn.net/guoming0000/article/details/7764709) detailed on how to use Microsoft's cloud space to get permanent external links, after my practice, indeed feasible! The size is 7 GB. However, the download speed may not be very smooth and remains to be verified. (The school's network speed is too fast and there is no reference value)

In addition, you must note that the music name in v1.8 must be a Chinese name and cannot contain English or numbers! The name of a singer does not matter!

(7) modify the content on the page

You can modify the parameters in EaglePHP \ App \ Home \ View \ Include \ foot. tpl.

Note that you can change the qq number to your own. If you don't want him, delete it.

To

, Including the two parentheses.

Similarly, if you modify the content of the top line on the webpage, you will receive a message and feedback. If you attempt to connect to Weibo, you will be able to open the head. tpl file in the same path for modification ~

(8) modify the category (that is, the category of the webpage homepage)


This step is very important and requires you to familiarize yourself with it. Generally, all nodes are parent nodes and subnodes (or main directories and parent Directories). Even if the main directory name is deleted, there is nothing to do with the articles stored in the sub-directories, so you don't have to worry about changing the main directory of the page, content is lost.

(9) change the no_img icon

Try it by yourself

(10) set up Weibo show!

EaglePHP Weibo is the microblog of the group owner. Naturally, you have to change it to your own microblog! I currently know that Sina Weibo supports the 'weibo show' (Open Sina Weibo account, my tool, Weibo gadgets, and Weibo show), find this stuff, and set it on your own, click Copy code to get the embedded code. Replace the boss code in the file subContent. tpl!

(11) modify "case" and "favorites" on the page category"

These two things are not really usable. In (7), we mentioned the head. tpl file, and we can see that there is a line.

  • Case

    That's right. He shows the classification of the case. Let's comment it out! As follows:

    .

    (12) page layout Effect

    It is mainly defined in base.css under EaglePHP2.0 \ Pub \ home \ css.

    I think the Website logo is not big enough. Let's change its size. Search for the keyword header in the file, which is the logo size style. I changed it to the following format:

    # Header h1 {float: left; display: inline; margin-left: 8; margin-top: 5px; width: 241px; height: 80px; overflow: hidden; background: url (.. /imgs/logo.png) no-repeat 0 0; text-indent:-9999px; line-height: normal ;}

    # Header h1 a {display: block; width: 239px; height: 78px; overflow: hidden ;}

    # Header h2 {display: none ;}

    The first is the display size, and the second is the size of the connection range. You can try to understand it.

    Usage Problems

    I also found that news images and classification columns are far apart, so I changed height = 96 to 86, which is compact, but cannot be too small. Otherwise, the search bar will be moved. (The code is in the previous line of # header h1)

    # Header {position: relative; height: 66px; z-index: 999999 ;}

    The style of the right column is set in the pub \ home \ css \ index.css file, especially subContent and tabContent.

    (13) Disable weather forecasts in the background

    When you use eaglePHP again, problems often occur every time you go to the background for management! Many experiments have found that it is the reason for weather loading. The weather was good, but we were not able to perform background management because of its loading failure, which made us very unhappy. Find the file Index. tpl under EaglePHP2.0 \ App \ Admin \ View \ Index or EaglePHP1.8 \ App \ Admin \ View \ index. There is a file in line 176

    Structure, including "select city" and other text, commented out! Use lines from 176 to 190 <-- = "">

    (14) Sort blog posts based on the Update time. The default sorting method is create_time, it makes more sense at this time. This is especially useful when some articles are updated on a large scale in the future. If it cannot display the latest list at this time, it will make people unhappy.) Open the App \ Home \ Model \ NewsModel. class. in the PHP file, modify the public function getList ($ perpage = 15) function of "or news list" to find the definition of $ news_list. We will change the line to this! (Understand SQL at a Glance) $ news_list = $ this-> field ('Id, title, type, description, img, create_time, update_time ') -> where ($ SQL)-> order ('rank ASC, update_time DESC ')-> limit ("{$ page-> offset}, {$ perpage }") -> select (array ('cache' => true); then the article is sorted by update_time. The time in the article list is displayed with create_time. If you do not want this, you can modify mainContent. tpl under App \ Home \ View \ Include and change create_time to update_time.
    Change

    {$ News_list [loop]. update_time | date_format: "% Y-% m-% d % H: % M "}}

    The effect is as follows.

    Database related:

    1. Modify the rename table tb_name TO new_name for the mysql data table name;

    Use EaglePHP

    1. Unable to update-> clear Cache

    15:36:01 eaglePHP
    The front-end has cached the query result set of the category and article list. After data is processed in the background, you need to clear the cache in the Application Center-system management.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.