Simplifying Code

Started on the old forum in August 2008 · view the original in the archive · old links redirect here

10 replies · 655 views · started 18 years ago · 1 min read

2 participants
synergyx Developer · 100 posts #1

hey guys, i have been simplifying most of my codes eg:

i added the following in core.php

function pc()
        {
        $cen = "<p align=\"center\">";
        echo $cen;
        }

and

function pl()
        {
        $lef = "<p align=\"left\">";
        echo $lef;
        }

and

function pr()
        {
        $rig = "<p align=\"right\">";
        echo $rig;
        }

and

function pe()
        {
        $end = "</p>";
        echo $end;
        }
synergyx Developer · 100 posts #2

then in all your other scripts all you needa add is

echo webhead($uthm,$stitle);
        echo pc();
        echo "[b]head:[/b]
";
        echo "

";
        echo "text.
";
        echo "text.
";
        echo "text.

";
        echo pe();
        echo webfoot();

notice i added echo pc(); instead of the long statement

and the nice thing is you can do this with all your codes

synergyx Developer · 100 posts #3

now you can do this with any code. i have done it with all my images. i place the following in core.php

$rss_simg = "<img src=\"images/rss_s.gif\" alt=\"rss\"/>";
        $aboutus_limg = "<img src=\"images/aboutus_l.jpeg\" alt=\"*\"/>";
        $male_simg = "<img src=\"images/male_s.gif\" alt=\"*\"/>";
        $female_simg = "<img src=\"images/female_s.gif\" alt=\"*\"/>";

and in all your other scripts you just echo "$female_simg"; wherever you want the image to be displayed

synergyx Developer · 100 posts #4

you can also do this with your home link eg:

function homelink($ses,$home_simg)
        {
        $homelink = "<a href=\"index.php?action=main&ses=$ses\">$home_simg Home</a>";
        echo $homelink;
        }

and near the end of your other scripts and echo homelink($ses,$home_simg); instead of the long "<a href="index.php?action=main&ses=$ses">$home_simg Home</a>";

synergyx Developer · 100 posts #5

here is a perfect example:

echo webhead($uthm,$stitle);
        echo pc();
        echo "$email_limg
";
        echo "[b]Email:[/b]
";
        echo line();
        echo "

";
        echo "You can now send emails for free to anyone, anywhere, at anytime.
";
        echo "Use this service to invite your friends or family.
";
        echo "By clicking on OK, You agree to the terms and conditions of this website.
";
        echo "You also agree not to send abusive and offensive emails.
";
        echo "Spamming is illegal and is not permited on this website!!.
";
        echo "All offenders will be banned and deleted from this website, as well as reported to their service providers.
";
        echo "You have the right to hide your email address.
";
        echo "All emails sent will be logged into our database and monitored daily.

";
        echo "<a href=\"email.php?action=send&ses=$ses\">OK I AGREE</a>
";
        echo "<a href=\"index.php?action=main&ses=$ses\">NO I DISAGREE</a>
";
        echo line();
        echo "

";
        echo copyright();
        echo "
";
        echo line();
        echo "
";
        echo homelink($ses,$home_simg);
        echo pe();
        echo webfoot();
subzero Super moderator Fellow · 3,954 posts #6

nice but mine better in a way lol

headweb();
}else{
headwap();
}

bodyweb();
}else{
bodywap();
}

footweb();
}else{
headwap();
}

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

synergyx Developer · 100 posts #7

nice but im not talking about the head, body and foot tags, im talking about the extra long code we put in wen we dont even have to. like image links, links to other pages, dividers, etc

subzero Super moderator Fellow · 3,954 posts #8
function link_home()
{
echo  "<a href=\"index.php?\">Home</a>";
}

link_home();

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

synergyx Developer · 100 posts #9
function link_home()
{
echo  "<a href=\"index.php?\">Home</a>";
}

link_home();

exactly that but you can do it with practically all your long unwanted code

subzero Super moderator Fellow · 3,954 posts #10

You can do this

function link()
{
$home =  "<a href=\"index.php?\">Home</a>";
$link =  "<a href=\"index.php?\">Home</a>";
$link2 =  "<a href=\"index.php?\">Home</a>";
$link3 =  "<a href=\"index.php?\">Home</a>";
}

add anywhere in script echo $home; echo $link; echo $link2; echo $link3;

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

synergyx Developer · 100 posts #11

well you could do that if you wanted but it doesnt simplify much, you need to create a function of the code that you use the most, which in turn saves you time wen writing a script as well as saves on space too...... and they easier to remember

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close