Webocreation

Saturday, December 25, 2010

To control the view section of the MVC framework in PHP (Part 1 of 5)

class View
{
    function showGrid($data)
    {
        include_once ('components/product_category/views/grid.php');
    }
   
    function showForm($obj_,$cdata)
    {
        include_once ('components/product_category/views/form.php');
    }
}
?>

To list the product category from the database in PHP with the use of MVC framework (Part 5 of 5)


Product Categories


                 

              Add New Category
         

Form to show editable part and insert section in MVC of PHP(Part 2 of 5)




Untitled Document



<?php

$cmd = '';

if(isset($obj_))

{

$cmd = 'update';

$btnText = 'Save';

}

else

{

$cmd = 'insert';

$btnText = 'Add';

}

?>

<div class="heading">Add/Edit Categories</div>

<form method="post" onsubmit="return submitbutton('', 'f');" id="f" name="f" enctype="multipart/form-data" action="?menu=<?php echo $_REQUEST['menu']; ?>&p=<?php echo $_REQUEST['p']; ?>&p_sub=list&opt_view=<?php echo $cmd; ?>&edit_id=<?php echo $_GET['edit_id']; ?>">
<table width='50%' class='tblList' cellpadding='0' cellspacing='0'>

<tr class="tr_1">

<td style='padding-left:3px; width: 100px;'>Title </td>

<td>

<input type="text" required="1" id="title" title="Title" name="title" value="<?php echo $obj_['title']; ?>" class = "staff_dtl_text" />

</td>

</tr>

<tr class="tr_1">

<td style='padding-left:3px; width: 100px;'>Parent Category </td>

<td>

<select name="cat_id">

<option value="0">None</option>

<?php

foreach($cdata as $c)

{

?>

<option value="<?php echo $c['id']; ?>"><?php echo $c['title']; ?></option>

<?php

}

?>

</select> if you choose "None" that will be parent category

</td>

</tr>



<tr>

<td>&nbsp;</td>

<td>

<input type="submit" name='submit' value="<?php echo $btnText; ?>" class="submit" />

<input type="button" name='cancel' value="Cancel" onclick="document.location='<?php echo $_SERVER['HTTP_REFERER']; ?>';" class="submit" />

</td>

</tr>

</table>
</form>


Controller Part to list, grid, view, insert, update and delete in the MVC framework (Part 3 of 5)

include_once('components/product_category/model.php');
include_once('components/product_category/views/view.php');

class Controller
{
    function doAction()
    {
        switch ($_REQUEST['p_sub'])
        {
            case 'list':
                if($_REQUEST['opt_view'] =='insert')
                {
                   
                    Model::insert();
                }
               
                if($_REQUEST['opt_view'] =='delete')
                {
                    Model::delete($_GET['del_id']);
                }
               
                if($_REQUEST['opt_view'] =='update')
                {
                    Model::update($_GET['edit_id']);
                }
       
       
                $data=Model::getall(0);
                View::showGrid($data);
               
                break;
               
            case 'form':
                if($_REQUEST['opt_view'] =='edit')
                {
                    $obj_ = Model::getSingleItem($_GET['edit_id']);
                }
                $cdata = Model::getParentCategory();
                View::showForm($obj_,$cdata);
                break;
               
        }
    }
}
?>

function to edit or update, delete, insert and select as per requirement in MVC framework (Part 4 of 5)

class Model
{
    function getall($id)
    {
       
        $sql='select * from product_category where parent_id='.$id;
        $rs=mysql_query($sql);
        $list=array();
        while($row=mysql_fetch_assoc($rs))
        {
            echo '
    ';             echo $row['title'];             ?>                        Delete    Edit            echo '
  • ';
                Model::getall($row['id']);
                echo'

  • ';             echo '
';
        }
        return $list;
    }
    function getParentCategory()
    {
        $sql='select * from product_category where parent_id=0';
        $rs=mysql_query($sql);
        $list=array();
        while($row=mysql_fetch_assoc($rs))
        {
            $list[]=$row;
        }
        return $list;
    }

   
    function update($id)
    {
        $sql = 'UPDATE product_category SET title = "'.$_POST['title'].'"'.' WHERE id = '.$id;   
        mysql_query($sql);
    }
   
    function getSingleItem($id)
    {
        $sql='select * from product_category WHERE id = '.$id;
        $rs=mysql_query($sql);
        $list=array();
        while($row=mysql_fetch_assoc($rs))
        {
            $list[]=$row;
        }
        return $list[0];
    }
   
    function delete($id)
    {
        $sql = 'DELETE FROM product_category WHERE id  = '.$id;
        mysql_query($sql);
    }
   
    function insert()
    {
        $sql='INSERT INTO product_category(title,parent_id) VALUES ("'.$_POST['title'].' ","'.$_POST['cat_id'].' ")';
        //echo $sql;
        mysql_query($sql);
    }
}
?>

Friday, December 24, 2010

Funny things about education



Education is for those who can buy it. If you have no money then you don't have

right to be educated

Love at first sight is not love, its actually sexual attraction according to

scientific research.. ha ha funny , specially when there is hell lots of love songs

and movies and shits regarding this... "Love at first sight" is horny thing ..:D

Specially in Math , teacher teach some lesson ,ask him what's its use in future his reply will in +2 or in Bachelor i.e in higher level education.. ask him what's its use in real life there will be no answer.

Bill Gates left his study and made Microsoft , Mark Zuckerberg Left his study and made Facebook. Richard Branson left study and founded Richard Virigin Group and all of them are billionaires . Those who completed their study now works under them... kinda inspiration biographies.. ,

Why is Management teacher not manager ? why engineering teacher not engineer and account teacher C.A or accountant .

Engineering or BBA or CA toppers usually becomes teacher and Average students usually work in the field. ... why ask more be happy in Average.

I wonder what these +2 colleges are trying to prove by killing innocent Frogs and earthworms in name of education.

bholi ko kam pani aja gar rey, bholi ko kam aja garyo bhaney bholi k garney?

bholi dekhi sure padchu , esto bhaney ko pani 10 barsa bhaisakyo. ahiley samma tyo bholi ayena.

There are lots of people who say, i miss my school/co llege days, but i dont miss my school, i just miss my school friends and fun we had. fuck every thing beside this.


The people who runs early morning are fat people trying to lose weight, old people trying to be healthy, or student trying to reach school/college


education ma pani tax lagaey thukka esto pani ho aba

School is practice for the future, and practice makes perfect, and nobody's perfect, so why practice?


i wasnt born intelligent, neither education made me intelligent


ime to time when i see her my heart beat increases, this may be love ....
..
... or symptoms of cardiac arrest

There is saying, "Wear old Coat, but buy new Book" , after my deep research i found out that the person who said this is is book write and he owned a book shop.


I passed exam because of AIDS , if you want to pass exam you should also get AIDS .
see how funny is this word aids and can misinterpret the meaning , Finally AIDS is Funny.


To have Positive Mental Attitude, you shouldn't look back. Thats why I always sit at last bench ,so that i never have to look back.‌


Summeet Sonzu says
"kasto khal ko rule ho yo.euta ma fail bhayo bhane chai sabai ma fail hune re. Euta ma pass vayo bhane chai sabai ma pass kina na hunne?" I think we should also think about this unfair education & grading system‌


If u read the biography of sucessful people,u will find they left their study and everything to chase their dream..Problem is i don't have a dream, should i chase a good sleep first ?


there is news that hseb11 Result will be out on mangsir last week. I guess this yr also 50% student will fail..k garney jindagi estai ho koi pass koi fai

Tuesday, December 21, 2010

Image scrolling with div in marquee from left

<marquee scrolldelay="2" behavior="left" onmouseover="this.stop();" onmouseout="this.start();" scrollamount="5" >
<?
foreach($winners as $winner)

{
?>

<div class="winner_row" style="float:left;">

<h1><?=$winner['auc_name']?></h1>

<div class="img_left" ><img src="<?=UPLOAD_WINNER.$winner['feed_image'];?>" width="65" height="52" /></div>

<div class="winner_text">

<?=$winner['sold_for']?><br />

<?=$winner['sold_on']?><br />

Saved <?=$winner['saving']?>%

</div>

<div class="clean"></div>

</div>

<?

}

?>

</marquee>






Dynamic Image rollover from the database

<SCRIPT LANGUAGE="JavaScript">

<!--

var dimages=new Array();

var dimages1=new Array();

 



<?

$banners=$all->get_banner();



foreach($banners as $key => $banner)

{

?>

var numImages = <?php echo count($banners); ?>



dimages[<?php echo $key; ?>]=new Image();

dimages[<?php echo $key; ?>].src="<?=UPLOAD_BANNER_DIR.$banner['image']?>";

<? }?>

 

 

var curImage=-1;

function swapPicture()

{

if (document.images)

{

var nextImage=curImage+1;

if (nextImage>=numImages)

nextImage=0;

if (dimages[nextImage] && dimages[nextImage].complete)

{

var target=0;

if (document.images.myImage)

target=document.images.myImage;

if (document.all && document.getElementById("myImage"))

target=document.getElementById("myImage");



// make sure target is valid. It might not be valid

// if the page has not finished loading

if (target)

{

target.src=dimages[nextImage].src;

curImage=nextImage;

}

setTimeout("swapPicture()", 1000);

}

else

{

setTimeout("swapPicture()", 500);

}

}

}

setTimeout("swapPicture()", 1000);

//-->

</SCRIPT>

<div class="add_box">

<div class="add_top"></div>

<div class="add_mid">

<div align="center"><img src="images/add.gif" />



<?php



$banners=$all->get_banner_one();

foreach($banners as $banner)

{

?>

<? if($banner['banner_type']=="image"){?>

<img src="<?=UPLOAD_BANNER_DIR.$banner['image']?>" alt="" border="0" width="500px" height="200" ID="myImage" NAME="myImage" />

<? } else { echo $banner['code'];}?>

<?

}?>

</div>

</div>

<div class="add_btm"></div>

</div>

Wednesday, December 8, 2010

Elephant and Ant Jokes....very funny animal jokes from nepal

Why is the elephant scared of the computer? Because of the mouse.

eakchoti 2ta kamila haru masta sanga raksi piyera road ma basira thye re...tyahi bela para bata hatti eaklai darai darai aaira dekhechan. ani eauta kamila le aarko lai tyo hatti lai gayera kutidiu bhanecha. aarko kamila chai pura jos ma aara chode eaklai cha bichara..eaklai cha bhanera tyasko faida uthauna hudaina bhanecha

Eakchoti kamila le hatti sanga tyasko ganji magecha...ani hatti le kina bhanera sodhda kamila le mero ghar ma bholi bhoj cha tyasko lagi pal chaiyeko cha bhanecha..


Once an hunter was chasing an elephant, the elephant ran into a forest, on the way it met its Ant friend, Ant : Hey, why are you running? Elephant : Hunter is chasing me. Ant (Generously) : You come and hide behind me. Elephant : ??!


ek din kamila le hatti lai khedaudai thiyo. daudida daudidai hatti mandir bhitra lukecha. kamila le hatti bhitra chireko na dekhe pani, bhitra gayera chyappa samatera, dyam ki dyam kutecha. kamila le hatti bhitra bhayeko kura kasari tha payo?????


eakdin hattilai school jana mann lagenacha ani hatti kamila sanga help magna gayecha..
hatti: kamila!kamila!!!!aaja malai school janai mann chaina..aamale bhetnubhayo bhane school pathaunu huncha......
kamila: chinta nagara sathi..mero pachadi luka ani timilai kasaile bhetdaina


eak choti kamila le aafno studentharulai sodecha
kamila:1ta hattiko aagadi 12ta kera rakheko thyo. hattile 11o'ta khayo1ta khayena.kina hola la bhana ta babunanai ho!!
student:#@&###@@!!!!!pass
kamila: kina bhane tyo12th kera plastic ko thyo!!! hehe!!
...
aaba chai 1ta hattiko aagadi 12ta kera rakhda kunai khayeana.kina??
kina ki tyo hatti nai plastic ko thyo


एक दिन एउटा हात्ती पोखरी मा नुहाउदै थीयो तेही बेला कमिला नजिकै आएर हात्ती लाई पोखरी बाट बहिर आउन भन्यो ।हत्ती ले किन आउनी भनेर सोद्यो अनी कमिल ले वन्यो मेरो कट्टु लाछौ कि भनेर ।


eak choti kamila le hatti lai bhane cha re
kamila: hatti dai! hatti dai! malai tapaiko ganji eakdinko lagi dinusna
hatti: kina chahiyo talai mero ganji???
kamila:mero gharma bholi huna lageko partyko lagi tent chaiyeko cha.

एक दिन कमिला ले हात्ती लाई खेदाउदै थियो। दौदिडा दौदिदै हात्ती मन्दिर भित्र लुकेछ। कमिला ले हात्ती भित्र छिरेको न देखे पनि, भित्र गएर च्याप्प समतेर, ड्यम् कि ड्यम कुटेछ। कमिला ले हात्ती भित्र भएको कुरा कसरी था पायो

किन भने हात्ती ले आफ्नो ४ ओ...टै चप्पल मन्दिर बाहिर खोलेको थियो

Tuesday, December 7, 2010

My new way to study.....

So why to study when it is mathematically proved if we study we fail
My new way to study.....
How to prepare for exam.....

Friday, December 3, 2010

Popular Updates in the facebook from my friends....the most commented and like

* If a boy calls you hot, he looks at your body. If he calls you pretty, he looks at your face. But if he calls you beautiful, he looks at your soul
* IT WASN'T ME!!! oh.. THAT.. heh, yeah that was me.
* Don't make any decisions when you're angry...And never make any promises when you're happy...
* When you love, you get hurt. When you get hurt, you hate. When you hate, you try to forget, When you try to forget, you start missing. When you start missing, You fall in Love Again ?
* When a song instantly reminds you of a person... a place... a memory...
* I ? my own bed. But i'll be honest, id much rather be in yours ;)
* I've learned that no matter how much I care, some people are just assholes.
* Can somebody please tell this bitch nobody likes her.
* I am in a relationship with studies and it's complicated
* smiling randomly when you remember something that once made you so happy :)
# Are you a parking ticket? (What?) You got fine written all over you.
# If your best friend's name starts with an A, C, D, E, F, G, I, J, K, M, N, P, R, S, T ?
# You look hot. At night. Miles away. Behind a wall. In a cave. Deep underground. To a blind person
# I Don't Stalk, I Observe
# Aww, that's sweet. Now how many girls have you said that to?
# Death leaves a heartache no one can heal, love leaves a memory no one can steal
# Good girls are just bad girls who don't get caught
# but... you promised! :(
# boy: wat would u do if i punched u? girl: i would punch you back.. boy: and if i slapped you? girl: i would slap you back.. boy: and if i loved you? girl: :)
# 'hahahahahahahaha' 'what are you laughing at?' 'i dont even know but i cant stop!'
# When I open a pack of bread I skip the first slice cause it's ugly
# drinking sprite like its water... :D
# I'm The Girl. You're The Boy. You Text Me First Or We Don't Talk Today
# Chill, I don't want your boyfriend
# yo come with me to the store. NO! , ill buy you something... ok :)
# I'm done trying. If you want me in your life, let me know. Bye.
# Even if i had a million reasons to leave you, I would look for one good one to stay
# math can suck my dick
# Yeah, I'm quiet... around you. You should see me with my friends.
# Don't Kayne me. Or I'll Chris Brown you and Tiger Woods your mother!! ;]]
# Sitting on Facebook liking random pages cuz your bored
# You know, somebody actually complimented me on my driving today. They left a little note on the windscreen, it said "Parking Fine".
# Lying down at night thinking about those moments you just wanna re-live
# Good friends don't let you do stupid things... not alone

Popular Updates in the facebook from my friends....the most commented and like

* If a boy calls you hot, he looks at your body. If he calls you pretty, he looks at your face. But if he calls you beautiful, he looks at your soul
* IT WASN'T ME!!! oh.. THAT.. heh, yeah that was me.
* Don't make any decisions when you're angry...And never make any promises when you're happy...
* When you love, you get hurt. When you get hurt, you hate. When you hate, you try to forget, When you try to forget, you start missing. When you start missing, You fall in Love Again ?
* When a song instantly reminds you of a person... a place... a memory...
* I ? my own bed. But i'll be honest, id much rather be in yours ;)
* I've learned that no matter how much I care, some people are just assholes.
* Can somebody please tell this bitch nobody likes her.
* I am in a relationship with studies and it's complicated
* smiling randomly when you remember something that once made you so happy :)
# Are you a parking ticket? (What?) You got fine written all over you.
# If your best friend's name starts with an A, C, D, E, F, G, I, J, K, M, N, P, R, S, T ?
# You look hot. At night. Miles away. Behind a wall. In a cave. Deep underground. To a blind person
# I Don't Stalk, I Observe
# Aww, that's sweet. Now how many girls have you said that to?
# Death leaves a heartache no one can heal, love leaves a memory no one can steal
# Good girls are just bad girls who don't get caught
# but... you promised! :(
# boy: wat would u do if i punched u? girl: i would punch you back.. boy: and if i slapped you? girl: i would slap you back.. boy: and if i loved you? girl: :)
# 'hahahahahahahaha' 'what are you laughing at?' 'i dont even know but i cant stop!'
# When I open a pack of bread I skip the first slice cause it's ugly
# drinking sprite like its water... :D
# I'm The Girl. You're The Boy. You Text Me First Or We Don't Talk Today
# Chill, I don't want your boyfriend
# yo come with me to the store. NO! , ill buy you something... ok :)
# I'm done trying. If you want me in your life, let me know. Bye.
# Even if i had a million reasons to leave you, I would look for one good one to stay
# math can suck my dick
# Yeah, I'm quiet... around you. You should see me with my friends.
# Don't Kayne me. Or I'll Chris Brown you and Tiger Woods your mother!! ;]]
# Sitting on Facebook liking random pages cuz your bored
# You know, somebody actually complimented me on my driving today. They left a little note on the windscreen, it said "Parking Fine".
# Lying down at night thinking about those moments you just wanna re-live
# Good friends don't let you do stupid things... not alone

Wednesday, December 1, 2010

Australian celebrity famous video

Amy Taylor





Andrew Bogut
Andrew Bogut
An Australian big man who dominated while playing center for the Utah Utes in the NCAA, Andrew Bogut was one of the top prospects for the 2005 NBA Draft. He was drafted #1 overall by the Milwaukee Bucks.



Anna Rawson
Anna Rawson
An Australian golfer and model, Anna Rawson has played on the Ladies European Tour and in the LPGA. She also played for the University of Southern California in college.


Anna Torv
Anna Torv
An Australian actress, Anna Torv's TV credits include "Fringe", "Mistresses", "The Secret Life Of Us" and "Young Lions."


Ashleigh Francis
Ashleigh Francis
A beauty queen, Ashleigh Francis represented Australia at the 2010 Miss World pageant.