Laboratory‎ > ‎

Web Programming

The webmaster, also called the web architect, the web developer, the site author, or the website administrator, is the person responsible for designing, developing, marketing, or maintaining a website. On community websites, webmasters are able to change and manipulate any comment that the users make. The following includes my duties as a webmaster of Hoonio.com and records of useful tips for development and maintenance.

Contents control The following are the links to webpages that I use to manage the site contents.

  • Revision: modification records
  • goDaddy domain control and hosting
  • PHP MyAdmin
  • Blog administration 
  • Google Apps cPanel Google Apps provides mail, document editor within browser, calendar, etc.
  • Recent changes
  • Wiki sitemap generator
  • Customization guideline
    • Web integration: Single menu, Facebook, Tweeter, me2day into one site
    • iWeb speedup
    • Customizing Wiki settings
    • Flash menu

Advertising Once done making a website, now it is time to advertise the website and attract visitors. The most effective way for advertising is to register your site on blog search. These are some of the popular ones in and outside Korea.

Backup

  • Anchor layout/contents backup for the frontpage and other fixed pages
  • Previous hosting service
  • MediaWiki guideline: Open up /skins/monobook/main.css and modify h1{} to h6{} level 1 to level 6 headlines to change font style/size
  • WikiHooni backup at Cafe24
    • phpMyAdmin for this backup
  • Inactive pages
  • Blogger template source backup

References & Resources


Google commands
"%s" exact phrase
-%s exception word
~%s synonyms inclusion
define:%s definition
%s= calculation
* wildcard
? calculation
filetyle:doc 

Facebook feed load

<?php
 
require 'facebook.php';
 
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
  'appId'  => 'xxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxxx',
  'cookie' => true,
));
 
 
 
// We may or may not have this data based on a $_GET or $_COOKIE based session.
//
// If we get a session here, it means we found a correctly signed session using
// the Application Secret only Facebook and the Application know. We dont know
// if it is still valid until we make an API call using the session. A session
// can become invalid if it has already expired (should not be getting the
// session back in this case) or if the user logged out of Facebook.
$session = $facebook->getSession();
 
$me = null;
// Session based API call.
if ($session) {
  try {
    $uid = $facebook->getUser();
    $me = $facebook->api('/me');
  } catch (FacebookApiException $e) {
    error_log($e);
  }
}
 
// login or logout url will be needed depending on current user state.
if ($me) {
  $logoutUrl = $facebook->getLogoutUrl();
} else {
  $loginUrl = $facebook->getLoginUrl();
}
 
// This call will always work since we are fetching public data.
$hoonio = $facebook->api('/H00NIO');
$wall = $facebook->api('/H00NIO/feed');
$dataparse = $wall[data];
 
$counter = 0;
foreach($dataparse as $entry)
{
if (++$counter == 5) { 
       break; 
} 
$post = $entry[message];
$icon= $entry[icon];
$from= $entry[from];
$author = $from[name];
echo $author;
echo $post;
}
 
?>
<!doctype html>
<html xmlns:fb="http://www.facebook.com/2008/fbml">
  <head>
    <style>
      body {
        font-family: 'Lucida Grande', Verdana, Arial, sans-serif;
      }
      h1 a {
        text-decoration: none;
        color: #3b5998;
      }
      h1 a:hover {
        text-decoration: underline;
      }
    </style>
  </head>
  <body>
    <!--
      We use the JS SDK to provide a richer user experience. For more info,
      look here: http://github.com/facebook/connect-js
    -->
    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId   : '<?php echo $facebook->getAppId(); ?>',
          session : <?php echo json_encode($session); ?>, // don't refetch the session when PHP already has it
          status  : true, // check login status
          cookie  : true, // enable cookies to allow the server to access the session
          xfbml   : true // parse XFBML
        });
 
        // whenever the user logs in, we refresh the page
        FB.Event.subscribe('auth.login', function() {
          window.location.reload();
        });
      };
 
      (function() {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
    </script>
 
    <img src="<?php echo $icon; ?>">
 
   <?php if ($me): ?>
    <a href="<?php echo $logoutUrl; ?>">
      <img src="http://static.ak.fbcdn.net/rsrc.php/z2Y31/hash/cxrz4k7j.gif">
    </a>
    <?php else: ?>
    <div>
      Using JavaScript &amp; XFBML: <fb:login-button></fb:login-button>
    </div>
    <div>
      Without using JavaScript &amp; XFBML:
      <a href="<?php echo $loginUrl; ?>">
        <img src="http://static.ak.fbcdn.net/rsrc.php/zB6N8/hash/4li2k73z.gif">
      </a>
    </div>
    <?php endif ?>
 
    <h3>Session</h3>
    <?php if ($me): ?>
    <pre><?php print_r($session); ?></pre>
 
    <h3>You</h3>
    <img src="https://graph.facebook.com/<?php echo $uid; ?>/picture">
    <?php echo $me['name']; ?>
 
    <h3>Your User Object</h3>
    <pre><?php print_r($me); ?></pre>
    <?php else: ?>
    <strong><em>You are not Connected.</em></strong>
    <?php endif ?>
 
    <h3>Hoonio</h3>
    <img src="https://graph.facebook.com/H00NIO/picture">
    <pre><?php print_r($dataparse); ?></pre>
 
 
  </body>
</html>


Twitter oauth integration

<?php
 
require 'tmhOAuth.php';
$tmhOAuth = new tmhOAuth(array(
  'consumer_key'    => 'VfUSoN1LRaKR3459c9Lzdw',
  'consumer_secret' => 'xxxxxxxxxxxxxxxxxxxx',
  'user_token'      => 'xxxxxxxxx-xxxxxxxxxxxxxxxx',
  'user_secret'     => 'xxxxxxxxxxxxxxxxx',
));
 
$tmhOAuth->request('GET', $tmhOAuth->url('1/statuses/user_timeline')
);
 
if ($tmhOAuth->response['code'] == 200) {
  $content=json_decode($tmhOAuth->response['response']);
} else {
  $tmhOAuth->pr(htmlentities($tmhOAuth->response['response']));
}
 
$counter == 0;
foreach($content as $entry)
{
if (++$counter == 10) { 
       break; 
} 
 
$tweet = $entry->text;
$time = $entry->created_at;
$location = $entry->place->full_name;
 
$created_monthday = substr($time, 3, 8);
$created_time = substr($time, 10, 6);
$created_year = substr($time, 26, 4);
$time_informat = $created_time . $created_monthday . $created_year;
 
if(!is_null($location)){
$time_informat= $time_informat . " at " . $location;
}
$print_line="<b>{tweet}</b>&nbsp;<i> {time_informat}</i><br /><br />";
$print_line=str_replace("{tweet}",$tweet,$print_line);		
$print_line=str_replace("{time_informat}",$time_informat,$print_line);
 
echo $print_line;
}
 
error_reporting(E_ALL&(~E_NOTICE));
?>

Scribbles on HTML5
<wbr> to insert conditional line breaks
<figure> to insert image
<textarea spellcheck='true'>
<input type='tel, email, url, date ... so on>
$('document').method -
<nav id
<audio controls preload='metadata'> <source src="(url)" type
<element draggable='true'> $('[draggable='true']').each(function)
Comments