Showing posts with label Blogger - Web code - Money Online. Show all posts
Showing posts with label Blogger - Web code - Money Online. Show all posts

[Blogger Template] - Boutique Template ( Support eCommerce )

Posted by NGTHFONG - 阮・青・風 On Saturday, January 4, 2014 3 コメント

Hôm nay dạo xem template blogger thấy một template dành cho blogger đẹp, free có khả năng phát triển thành một website eCommerce khá tốt. Đây là trang CCS3 hỗ trỡ HTML5 rất hợp thời trang.



Editor CSS:

Configure Featured Content Slider:
Login to blogger dashboard --> layout --> Edit HTML. Now scroll down to where you see the codes below:
  •  <div class='slide'>
     <div class='featured-image'>
     <a href='#'><img alt='Back To School Supplies' height='230' src='/product.png' width='380'/></a>
     <div class='featured-price'>
     <a class='add_cart et-shop-item' href='#'>Add To Cart</a>
     <a class='more_info' href='#'>More Info</a>
     <span class='price'>25</span>
     <span class='currency_sign'/>
     </div> 
     </div> 
     <div class='featured-description'>
     <h2 class='featured-title'><a href='#'>Back To School Supplies</a></h2>
     <p>Vivamus eget nulla id elit volutpat...</p>
     <a class='readmore' href='#'><span>More Info</span></a>
     </div> 
     </div>
     ............
Replace:
  • "#" with your featured post URL.
  • "product.png" with your slider image.

Configure Dropdown Menu:
Login to blogger dashboard --> layout --> Edit HTML. Now scroll down to where you see the codes below:
  • <div id='menu-content'>
    <div id='menu-shadow'/>
    <ul class='nav clearfix' id='secondary-menu'>
     <li><a href='#'>Backpacks</a></li>
     <li><a href='#'>Bathroom</a></li>
     <li><a href='#'>Accessories</a>
    <ul class='sub-menu'>
     <li><a href='#'>Bathroom</a></li>
     <li><a href='#'>Clothing</a></li>
     ...........
Replace "#" with your menu item URL.

Configure Page Navigation Widget
search for:
  • var posts=12, // Number of posts in each page
        num=2, // Number of buttons will display

How to add price to a product
Add this line before publishing new product (in HTML mode):
  • <span class="item-price">15</span>

How to change currency sign
Search for:

  • var currency="£";


Add Facebook Like Button To Blogspot/ Blogger Step-by-Step

Posted by NGTHFONG - 阮・青・風 On Wednesday, May 8, 2013 3 コメント

Lâu ngày không đụng lại HTML và CSS. Hôm nay ôn lại. Sẵn tiện viết bài hướng dẫn add button Like của Facebook vào Blogger luôn cho các new-bie. ^^


Bước 1. Đăng nhập vào trang này facebook like button ở link này => Facebook development
Chọn kích thước hiển thị theo ý thích của bạn rồi nhấn nút "Get code" ở hình bên dưới

Copy đoạn code hiện ra như hình bên dưới:


Bước 2. Login vào Blogger.com
Bước 3. Chuyển sang chế độ edit HTLM của template như hình bên dưới
blogger-edit-html

Bước 4. Search đoạn code
<b:if cond='data:post.url'><a expr:href='data:post.url'><data:post.title/></a>
Bước 5. Dán đoạn code copy được ở bước (1) vào ngay bên dưới đoạn code trên. 

Bước 6. Save lại template thế là xong.
Chúc các bạn thành công! :)



プログラム言語の比較: PHP vs Java

Posted by NGTHFONG - 阮・青・風 On Wednesday, July 21, 2010 0 コメント

 プログラム言語っていろんな種類がありますが、何を学んだら一番自分のやりたいことができるか、なんてわかりませんよね。



下記にはその言語でできることを整理してみましたので是非ご参考にしてみてください。
また、受講カウンセリング(無料)やお問合せもお気軽にどうぞ。

どんな機能が作れるのでしょうか?

WEBサイトに必要な様々な機能。各言語によって何を作ることができるのでしょうか?
PHPJavaHTMLJavaScriptPerl
ショッピングサイト
掲示板
オンラインゲーム
携帯アプリ
チャット
ブログ
動画・アニメ


VertrigoServにPEARをインストールしてMDB2を利用する

Posted by NGTHFONG - 阮・青・風 On Thursday, July 8, 2010 0 コメント

いつもPEARのインストールでハマるから覚書。
cmdを立ち上げて、PHPディレクトリまで行く。
私はC:\VertrigoServ\Phpだけど、デフォルトはC:\Program Files\VertrigoServ\Phpだと思う。たぶん。
で、以下を実行
C:VertrigoServ\Php>php PEAR\go-pear.phar
英語がズラズラ出て来るから、Enter押す。
何度か(3回ぐらい?)Enterを押すと完了。
PEARのディレクトリに移動して pear コマンドが使えるか確認。
C:\VertrigoServ\Php>cd pear
C:\VertrigoServ\Php\PEAR>pear
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel
以下省略
次はMDB2のインストール。
の前に、VertrigoServのタスクトレイアイコンをクリックしてSettings>Components settingsを開き、左から2番目のPHPの枠内にあるmemory limitを8Mから256Mに変更してから、以下を実行。
C:\VertrigoServ\Php\PEAR>pear install MDB2
その後、Mysqlのドライバをインストール。
C:\VertrigoServ\Php>pear install MDB2_Driver_mysql
ついでにSQLiteもインストール。
C:\VertrigoServ\Php>pear install MDB2_Driver_sqlite
以下サンプル。
データベースの作成
CREATE DATABASE `sample` ;
テーブルの作成
CREATE TABLE `user` (
`user_id` int(11) NOT NULL auto_increment,
`user_name` varchar(32) NOT NULL,
`gender` varchar(3) NOT NULL,
`addr` varchar(100) NOT NULL,
PRIMARY KEY (`user_id`)
);
テーブルにデータを挿入
INSERT INTO `user` (
`user_name` ,`gender` ,`addr`
) VALUES (
‘中村良子’, ‘女’, ‘東京都台東区浅草’
), (
‘鈴木太郎’, ‘男’, ‘東京都新宿区百人町’
);
sample.php
<HTML>
<HEAD>
<META http-equiv=”Content-Type” content=”text/html; charset=utf-8″>
</HEAD>
<body>
<?php
require ‘MDB2.php’;
$DSN=’mysql://username:pass@localhost/sample?charset=utf8′;
$mdb2 =& MDB2::connect($DSN);
    if (PEAR::isError($mdb2)) {
    die($mdb2->getMessage());
}
$mdb2->setFetchMode(MDB2_FETCHMODE_ASSOC);
$table = ‘user’;
$query = ‘SELECT * FROM ‘.$table;
$result = $mdb2->query($query);
    while ($row = $result->fetchRow()) {
        $tmp .= ‘<tr>’;
        $tmp .= ‘<td>’.$row["user_id"].’</td>’;
        $tmp .= ‘<td>’.$row["user_name"].’</td>’;
        $tmp .= ‘<td>’.$row["gender"].’</td>’;
        $tmp .= ‘<td>’.$row["addr"].’</td>’;
        $tmp .= ‘</tr>’;
    }
?>
<table border=”1″ cellpadding=”5″ cellspacing=”5″ style=”font-size:12px;text-align:center;”>
<tr>
    <td>ユーザーID</td>
    <td>名前</td>
    <td>性別</td>
    <td>住所</td>
</tr>
<?= $tmp ?>
</table>
<?php
$mdb2->disconnect();
$mdb2->free()
?>
</body>
</html>


    Send Emails Using Php (SMTP Direct)

    Posted by NGTHFONG - 阮・青・風 On Wednesday, June 2, 2010 2 コメント

    This is an alternative way to generate & send an email under php, rather than using the pre-defined mail() function.

    Reasons:
    In what situations would you not want to use something as simple as the mail function?

    1.) Your php/web server does not offer mail.
    On our internal network, the mail server exists on a server other than the web server. 
    Therefore, mail() will fail to send since 
    a.) port 25 is blocked
    b.) sendmail is disabled

    2.) Your mail server doesn't use the default port 25 for sending email.
    If you are running a server on non-commercial service, you know what I'm talking about =-)
    This can, however, be changed via the php.ini configuration file.

    3.) Because you can. 
    It allways feels good (maybe even better) when you know the how's & why's to your equipment & software. So why just send an
    e-mail when you can build one?!

    4.) Your sendmail_from value needs to change on the fly.
    Maybe you host multiple accounts, & one sendmail_from value is not enough. Maybe you are hosting something much more
    advanced & this single setting just isn't enough.
    Auto-responders, Auto-forwards, the list is endless.

    The setup:
    Since I use qmail as my MTA (mail transfer agent) that's the example you'll get. Please refer to the documentation that came with 
    your MTA, should you be setting up something different.

    1st, we need to define the function to use instead of mail(). 

    <?php
    function authgMail($from, $namefrom, $to, $nameto, $subject, $message) {
    


    As you can see, we've allready got a few more arguments than mail() has to offer.

    authgMail <- my chosen function name, you can alter this as you please. Just make sure that it isn't a keyword or existing function.

    Now to setup those values...
    $smtpServer = "192.168.xxx.xxx";   //ip address of the mail server.  This can also be the local domain name
    $port = "25";                                    // should be 25 by default, but needs to be whichever port the mail server will be using for smtp 
    $timeout = "45";                                 // typical timeout. try 45 for slow servers
    $username = "sales@mydomain.com"; // the login for your smtp
    $password = "myPA$$";                   // the password for your smtp
    $localhost = "127.0.0.1";          // Defined for the web server.  Since this is where we are gathering the details for the email
    $newLine = "\r\n";                       // aka, carrage return line feed. var just for newlines in MS
    $secure = 0;                              // change to 1 if your server is running under SSL
    


    Those should be the only values that you need to change to match your own internal settings.
    The rest is the functionality of the server & those values. The variable $smtpResponse is going to let you know what's going on.
    You can use it to show you every step along the way, or just show errors reported back from the mail server.
    Now, lets build that e-mail!

    //connect to the host and port
    $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
    $smtpResponse = fgets($smtpConnect, 4096);
    if(empty($smtpConnect)) {
       $output = "Failed to connect: $smtpResponse";
       echo $output;
       return $output;
    }
    else {
       $logArray['connection'] = "<p>Connected to: $smtpResponse";
       echo "<p />connection accepted<br>".$smtpResponse."<p />Continuing<p />";
    }
    //you have to say HELO again after TLS is started
       fputs($smtpConnect, "HELO $localhost". $newLine);
       $smtpResponse = fgets($smtpConnect, 4096);
       $logArray['heloresponse2'] = "$smtpResponse";
    //request for auth login
    fputs($smtpConnect,"AUTH LOGIN" . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['authrequest'] = "$smtpResponse";
    //send the username
    fputs($smtpConnect, base64_encode($username) . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['authusername'] = "$smtpResponse";
    //send the password
    fputs($smtpConnect, base64_encode($password) . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['authpassword'] = "$smtpResponse";
    //email from
    fputs($smtpConnect, "MAIL FROM: <$from>" . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['mailfromresponse'] = "$smtpResponse";
    //email to
    fputs($smtpConnect, "RCPT TO: <$to>" . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['mailtoresponse'] = "$smtpResponse";
    //the email
    fputs($smtpConnect, "DATA" . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['data1response'] = "$smtpResponse";
    //construct headers
    $headers = "MIME-Version: 1.0" . $newLine;
    $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
    $headers .= "To: $nameto <$to>" . $newLine;
    $headers .= "From: $namefrom <$from>" . $newLine;
    //observe the . after the newline, it signals the end of message
    fputs($smtpConnect, "To: $to\r\nFrom: $from\r\nSubject: $subject\r\n$headers\r\n\r\n$message\r\n.\r\n");
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['data2response'] = "$smtpResponse";
    // say goodbye
    fputs($smtpConnect,"QUIT" . $newLine);
    $smtpResponse = fgets($smtpConnect, 4096);
    $logArray['quitresponse'] = "$smtpResponse";
    $logArray['quitcode'] = substr($smtpResponse,0,3);
    fclose($smtpConnect);
    //a return value of 221 in $retVal["quitcode"] is a success
    return($logArray);
    }
    


    Ok, that wasn't so bad... Now we can use php to error check the values passed in from a form, to verify that the server is not going
    to get some bogus value, or empty records & freak out.
    $err=0;  // so far, so good
    $err_msg="";
    if($_POST['name_']!="") { echo $_POST['name_']."<br>"; }
    else {
      $err=1;
      $err_msg="You must include your name";
    }
    if($_POST['day_phone_']!="") {echo $_POST['day_phone_']."<br>"; }
    else {
      $err=1;
      $err_msg="You must include a daytime phone number.";
    }
    if($_POST['add_']!="") { echo $_POST['add_']."<br>"; }
    else {
      $err=1;
      $err_msg="You must include your address.";
    }
    if($_POST['city_']!="") { echo $_POST['city_']."<br>"; }
    else {
      $err=1;
      $err_msg="You must include the city.";
    }
    // Check for the existence of an AT symbol inside the email.
    if (strpos($_POST['email'],"@")) { echo $_POST['email']."<br>"; } else {
      $err=1;
      $err_msg="You must include a current email address.";
    }
    if($_POST['email']!="") { echo $_POST['email']."<br>"; }
    else {
      $err=1;
      $err_msg="You must include your e-mail address.";
    }
    
    echo $err_msg;
    if($err<=0) {
      $from="sales@mydomain.com";
      $namefrom="Internal Sales Dept. of mydomain.com";
      $to = "internal_user@mydomain.com";
      $nameto = "internal_user";
      $subject = "Email from My Domain";
      $message = "Email from My Domain";
      // this is it, lets send that email!
      authgMail($from, $namefrom, $to, $nameto, $subject, $message);
    }
    else {
      echo "<p /> This form was not filled out correctly, please correct any mistakes.";
    }
    ?>
    


    In Conclusion:
    As you can see, it very easy to send an email using php & connecting directly to your smtp server.
    In addition you can add more receivers by either adding their addresses, comma separated, to the $to variable, or by adding cc: or bcc: headers.
    If you don't receive an email using this script, then you may have installed PHP incorrectly, you may not have permission to send emails, or you may have misconfigured your MTA.
    Before running this script, verify that your current MTA is working. That way you can trouble shoot this script, knowing that your MTA is set to recieve incomming connections.


    Example:




    <?php
    //new function

    $to = "post@example.com";
    $nameto = "Who To";
    $from = "post@example.com";
    $namefrom = "Who From";
    $subject = "Hello World Again!";
    $message = "World, Hello!"
    authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);
    ?>


    <?php
    /* * * * * * * * * * * * * * SEND EMAIL FUNCTIONS * * * * * * * * * * * * * */

    //Authenticate Send - 21st March 2005
    //This will send an email using auth smtp and output a log array
    //logArray - connection, 

    function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message)
    {
    //SMTP + SERVER DETAILS
    /* * * * CONFIGURATION START * * * */
    $smtpServer = "mail.server.com";
    $port = "25";
    $timeout = "30";
    $username = "smtpusername";
    $password = "smtppassword";
    $localhost = "localhost";
    $newLine = "\r\n";
    /* * * * CONFIGURATION END * * * * */

    //Connect to the host on the specified port
    $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
    $smtpResponse = fgets($smtpConnect, 515);
    if(empty($smtpConnect)) 
    {
    $output = "Failed to connect: $smtpResponse";
    return $output;
    }
    else
    {
    $logArray['connection'] = "Connected: $smtpResponse";
    }

    //Request Auth Login
    fputs($smtpConnect,"AUTH LOGIN" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authrequest'] = "$smtpResponse";

    //Send username
    fputs($smtpConnect, base64_encode($username) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authusername'] = "$smtpResponse";

    //Send password
    fputs($smtpConnect, base64_encode($password) . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['authpassword'] = "$smtpResponse";

    //Say Hello to SMTP
    fputs($smtpConnect, "HELO $localhost" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['heloresponse'] = "$smtpResponse";

    //Email From
    fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailfromresponse'] = "$smtpResponse";

    //Email To
    fputs($smtpConnect, "RCPT TO: $to" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['mailtoresponse'] = "$smtpResponse";

    //The Email
    fputs($smtpConnect, "DATA" . $newLine);
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data1response'] = "$smtpResponse";

    //Construct Headers
    $headers = "MIME-Version: 1.0" . $newLine;
    $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
    $headers .= "To: $nameto <$to>" . $newLine;
    $headers .= "From: $namefrom <$from>" . $newLine;

    fputs($smtpConnect, "To: $to\nFrom: $from\nSubject: $subject\n$headers\n\n$message\n.\n");
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['data2response'] = "$smtpResponse";

    // Say Bye to SMTP
    fputs($smtpConnect,"QUIT" . $newLine); 
    $smtpResponse = fgets($smtpConnect, 515);
    $logArray['quitresponse'] = "$smtpResponse"; 
    }
    ?>


    Recent comments