Thursday, September 27, 2012

Php using page partitions.

When writing scripts in php a good way to handle mapping a site is by establishing Page Partitions. Page parts will allow you to not have to keep re-writing headers, menus, contents, footers and sections repeatedly throughout all your sites pages. And then you can call them in using Php when and where you need them.
 The idea behind this is to have a MVC type plan to not repeat anything over and over again.
    Create your sites first page. Then break it up into sections. Then Place these sections copied into a page named after them like--header.php, content.php, leftmenu.php, rightmenu,php, footer,php. Things that normally will not change. Next we will call them into our programmed pages as we need them using the Includes Function. Below we show you how this is done.

Do code

Do code

?php

incude('header.php');
?

Show html and other code sections etc.


?php

include('leftmenu.php');
?

Show html and other code sections etc.


?php

include('content.php');
?

Show html and other code sections etc.


?php

include('footer');
?

Show etc.




 

Wednesday, September 26, 2012

codesneekers blog: Php Create a Members List Page And Users Page.

codesneekers blog: Php Create a Members List Page And Users Page.: When deciding how to develop Members Areas on your Site. It is always a chore to remember how to pass the users data from Page To Page. The ...

Tuesday, September 25, 2012

Php Create a Members List Page And Users Page.

When deciding how to develop Members Areas on your Site. It is always a chore to remember how to pass the users data from Page To Page. The Script Below will help.

FIRST PAGE --------WE SHOW ALL MEMBERS

<?php

  $res = mysql_query('select id, username, email, mempic, date from users desc');
  if(mysql_num_rows($res)>0)
  {
    $result = mysql_fetch_array($res);
    }
?>
//MAY SHOW CERTAIN HTML PAGE PARTS HERE//
<?php
}
else
{
echo "No users data found";  //PLACE ERROR HERE
}
?>
SHOW OUR DATA----


<ul><h3>Members List</h3></ul>
<ul>
    <li>User/Id</li>
    <li>Image/Path</li>  // OR USERS URL PATH TO IMAGE change img tag path below&page-2 ! //
    <li>User/Name</li>
    <li>Email</li>
    <li>Date/Joined</li>
</ul>
<ul>    // NEXT WE PARSE THE USERS ID VALUE USING THE LINK
    <li><a href="profile.php?id=<?php echo $result['id']; ?>">View User</li>
    <li><?php echo $result['mempic']; ?></li>
    <li><?php echo $result['username']; ?></li>
    <li><?php echo $result['email']; ?></li>
    <li><?php echo $result['date']; ?></li>
</ul>

<p>Scripts By Robin Deatherage  about2mount@gmail.com</p>

SECOND PAGE   SINGLE MEMBERS PAGE

<?php
if(isset($_GET['id']))  //FIRST WE GET THE ID OF USER FROM FIRST PAGE//
{
  $id = intval($_GET['id']);  // WE ASSIGN A VARIABLE//
  $dn = mysql_query('select id, username, email, mempic, date from users where id="'.$id.'"');
  if(mysql_num_rows($dn)>0)
  {
    $dnn = mysql_fetch_array($dn);
    }


//MAY SHOW CERTAIN HTML PAGE PARTS HERE//
<?php
}
else
{
echo "No user data found";  //PLACE ERROR HERE//
}
?>

NOW SHOW THE USERS DATA.
// NEXT WE PARSE THE the single users data
<h3>Profile Page</h3>
<h4>Welcome: <?php echo $dnn['username']; ?>
<p><img src="<?php echo $dnn['mempic']; ?>"></p>


<ul>  
    <li><a href="profile.php?id=<?php echo $dnn['id']; ?>">View User</li>
    <li><?php echo $dnn['username']; ?></li>
    <li><?php echo $dnn['email']; ?></li>
    <li><?php echo $dnn['date']; ?></li>
</ul>

GO DOWN HERE AND IF YOU WANT CREATE A ANOTHER PAGE FOR WHATEVER YOU WANT USING THE SECRETS ABOVE !       ENJOY !

Member Switch Profile Image To Avatar Script.

This conditional "IF" statement can become very usefull for you blog creators out there who want to build on your members resources.
    First we want to check if the member has uploaded a PROFILE-IMAGE and IF they have not, then we will show our own in house AVATAR-IMAGE.


<?php
  if($result['mempic']!=' ')  //THE DATA OF IMAGE PATH STORED IN YOUR DB//
  {
    echo '<img src="'.htmlentities($result['mempic'], ENT_QUOTES, 'UTF-8'),'"alt="Avatar" style="max-width:100px;max-height:100px;" />';
  }
  else
  {                                //ALTERNATE AVATAR-IMAGE PATH HERE//
    echo '<img src="img/avatar.png" alt="Avatar" style="max-width:100px;max-height:100px;" />';
  }
     ?>

 THE     (  !=  ) IS  IF MEMPIC  (does-not-  "!"  equal  "="   'emty'     "  '  '  "
       {
     SHOW THE MEMBERS PIC.
       }
     ELSE
       {
     SHOW AVATAR AS REPLACEMENT.
       }
?>
CONTINUE WITH SCRIPTS---->

Monday, September 3, 2012

Php Tutorial

We have the power to learn. Yes learning to program using php is really not as hard as people think. The only hard thing about it is remembering where you place everything. Php and Html work very good together. Especially if you use PageParts. PageParts are partial page pieces that you can add into certain pages as needed or use on every page. A good page part would be the Head section of your site. Along with the horizontal page menu. So by using the INCLUDES function, we can do wonders with PageParts. Now to help us out mentally we call these PageParts MODULES. Easy to remember and now you understand the basic concept of Modules and php. You may have several modules to create. Examples would be Header's, Menu's, Content's, Script's, Views, Functions, Configs, Footers, and Images. Now we know that Modules can be everything broken down into Views, Scripts, and Configs. A Config File is a page you would want to declare certain Variables that allows you to change things like page-names or Url Paths and Links without having to change these on every single page. Example of these might be     $url_home="index.php"; which allows you to change the index.php to another page named home.php without having to enter it into all your sites pages because on all the pages the link is shown as <a href="<?php $url_home; ?>">Home</a>  Here it calls the data from your config file and automatically tells the link to go to the Value of $url_home,,,which equals index.php and can be any page you choose. like change it in the config.php file and it will change that page on all your sites pages. Another good use would be assigning your database config. $db_name="database-name, $db_user="database-user-name", $db_password="password here". Place Admin and Editor Variables as well here to,     $admin="your private admin login name here";     and $editor="editors name here";    Now you have a config.php file that you can add alot of things to later.

Amelia's Floating Plane !

Amelia ! The search continues ! It is always something to think about. The thing that is fact with Amelia and Fred's disappearance is the fact that Her plane was buoyant to the tune of 1500 pounds. Which meant her plane would have stayed afloat. And would have floated anywhere. With 1500 pounds of buoyancy the plane would have probably been half submerged or more with only the tail and part of the roof showing, but with a silver finish would have been impossible to see from overhead search planes. In them days in 1930's through the 40's. Safety colored vest and brightley colored rafts did not exist. Sad to think about but one can imagine several planes flying right over Them but never being seen. The only chance they had of being found would have been a flare fired at night. But if out of distance to-shay. Truth is Her Plane could have drifted for thousands of miles before sinking and sank in a spot that may never be found. Not to mention the fact that most of the Pacific is over 17,000 feet deep which is over three miles deep. One mile deeper than the Titanic. Maybe someday a sonar somewhere out there will kick back The Lost Electra and the Amelia Mystery can be solved.