Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Coding Style...


When i write a script, i tend to seperate the differnt functions with differnt files. For example. When i creat a user management script, i create and add_user.php file and a modify_user.php file, and so on. I also see a lot of people who simply write one big 10 meg php file that includes everything in one. (seperated into functions.)

Is there an advantage to this? Or is it just a matter of personal prefrence? I guess it really doesnt matter that much, i just wanted to know.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Optimization In Coding Style
I was wondering is there a point in optimization in code style... I
have used to put parenthesis around some php keywords, but they are not
needed.

For example, I always use:
echo( "String..." );
but I could use
echo "String...";

the same thing is with return:
return( $tempHTML );
as opposed to
return $tempHTML;

Also is there a point to variate between string delimiters " and ' ?
ie. is it better to use single quotes instead of double quotes if I
don't won't any variable in a string? For example:
'This is a string...'
as opposed to
"This is a string...".

Double quotes are needed, of course in other cases:
"Frankly my dear, your name is ${nameOfTheUser}!"

I know it sounds stupid, even hard to read, but what are your opinions?

Am I Too Wired? On Coding Style
I have a question that spining around my head for a long time. I
prefer to make this kind of if statement:

if (!$GLOBALS['phpgw_info']['user']['admin']) Header(
'Location: '.$GLOBALS['phpgw']->
link('/', 'menuaction=forum.uiforum.index')
);

But almost all the 'good' php code I saw write it this way:

if (!$GLOBALS['phpgw_info']['user']['admin'])
{
Header(
'Location: '.$GLOBALS['phpgw']->
link('/', 'menuaction=forum.uiforum.index')
);
}

the argument is the latter is more readable and easy to understand. But,
to me, a if statement immediately followed by another statement or
function call is more readable and easy to understand. It saved me from
thinking what's after this statement or function call. Truly, I think
keeping a stack of 'if' or 'for' in the brain is difficult for me, I
tends to remove the {} and add the statement after if-clause when if
statement contain only one statement.

I am just thinking if my way of keeping code logic in brain is too
wired. If most people truly consider the {} more easier to
read/understand, I'll force myself write understandable code; if there
are only very small difference in understanding (considering reading
10000 line of source, even small difficulty counts), I would like to
keep my style.

Wnat To Embed Full HTML Page In Email, But Migrating Style From Css Files To Element Style Attributes
My web pages of course use css files, but Webmail services require
style to be in element style attributes.

How do I convert a standard HTML page to HTML suitable for delivery to
webmail services?

Perhaps another way to ask the question is:

How to I walk the DOM and for every element, for every style, set the
element's style attribute to the values that are looked up in the css
file in normal rendering.

Anyone know of any tools, or examples to do this?

Same CSS Style In Php Segments.
I have several seperate individual php segment which make up my website. To
check what each segment actuallt displays I am linking my css style to each
and every segment in a wysiwyg program.

This results in a website with the same css file being called about 20
times. Of course I can delete all but one of these "link css rows" and then
add them again as and when a segment needs to be edited.

This seems to be a round about way of doing things even if it gets the job
done. Is there a more effective way?

Perl Style In Php ?
Often I just want to be able to get at a single element from a
function that returns an array. For example, if I just want the
current year I need to write:

$today = getdate();
$year = $today['year'];

Call me lazy but this is two steps to return a single value.
In perl I can nest these two step together into something like:

$year = ( $getdate() )['year'];

I've tried to get several variations of this to work in php but I
don't seem to be having any luck.

Is this style possible in php?

Style Class Css Or PHP?
Having had a little experience of HTML and style classes but only a limited
knowledge of PHP perhaps somebody can tell me the pros and cons of the
following.

Surely if I write something in PHP like

$style = "<b><i><font size=&#391;'>"
$endstyle ="</b></i></font>"
$s = array($style,$endstyle)
echo $s[0] . "I want my font in bold italic and size 1" . $s[1]

does this not do the same as style classes? Taking it one step further, if I
write all of the styles in a script called styles.php and include it in all of
my php pages is that not the same as having a .css file?

Why use 2 programming languages when it can be done in 1?

Inline CSS Style
I'm having a problem sending email using php mail. The email is designed with tables so I'm using inline CSS styles. Problem is that the styles do not work. It gets displayed as text. Code:

Current Code To MVC-ish Style
I want to convert this current piece of code into a MVC-ish structure style of coding:
PHP Code:

Devshed Style Url's
As you know devshed is a php based site that stores the articles in mysql. For example the article in the following url is a dynamic article that is produced by php :

http://www.devshed.com/Server_Side/...ache/page4.html

The thing that I want to know is how this url can be dynamic ? The url isn't something like: article.php?section=administration&id=2344

I think this is done using the rewrite module of apache.. but how? If the site admins or any one who knows how to do this please reply my message..If there is an article/tutorial about this subject please let me know.

Personal Bb Code Style
if i look at this form im filling out now they have the bbcode buttons, how do they work and how can i use this sort of idea for a for i have to out put certain variables eg:

if i am sending a email vaia my for and want all the first names to be included as a buton and last and the rest of there details, i think that this is VB code - is there a way to do it in PHP. also similer to the smilie faces it will replace it with the image when its submitted.

Formatting SQL Style Datetime
Is it possible to take a date in SQL form and format it with php?

2001-05-23 18:11:00 ---> processed --> 5/23/01 6:11pm

I won't be able to format when pulling from a database, or else this would be a lot simpler.

Hotmail Style Php Script
I would like to include to my web application a msg service like hotmail but
database based and not real webmail, does anybody 've already developped a
service like that with all of the options hotmail include ?

Ultima Style Rolegame With PHP...
its true now there is someone who wants
to add one of the best rolegames ever Ultima III
to his homepage...

Im very familiar with Visual C++ but not with PHP...

So, the question is how to...

What web sites i need to go thrue before i can
achive my goal a PHP Ultima III style rolegame
and is PHP compelitely wrong language to use ?

Java applet maybe ? I hav MS Visual Java...

Removing Page Style
I found a great script which turns a HTML page into a PDF, but the problem is it turns the whole page, with layout etc, into the pdf, which looks really bad with all the navigation etc, on it. Code:

Remove Style Tags
I have tried this:

<?php preg_replace("~<style(.*)>(.*)</style>~"," ",$getvid); ?>

It doesn't work, all I want to do is remove the style tags, and everything between them. In there place I want to insert a space.

Ip Address And Adding Style In Php ?
1. how do i get the ip address of the user visiting a page ?

2. echo "<span><pre>  $row[0]      $row[3]    This link worked for $row[1] out of $total people.  DID THIS LINK WORK FOR YOU ? <a href='worked.php'>YES</a>      <a href='notworked.php'>NO</a> </pre> </span>";
echo "<br>";

i want the output above display text with gray background color...how ?

Looking For GOOD Style Code Samples
Looking for GOOD code samples to learn good php style from. I'm talking about well structured code that tries to separate html / general PHP / database code.

It would make use of of modules/classes/libraries (whatever you call the method to encapsulate clean reusable functionality in PHP.

Also, any recommendation for good and fast pace PHP intro to in depth tutorial.
I don't need baby talk, just something clean and focused so I can be coding (clean code) really soon.


Wiki Style Text Input
I have a text file called test.txt which is I am trying to get to load
into a webpage. This is simple enough, but I am trying to make it so
that it recognises certain formatting, similar to how wikipedia pages
work.

so, my text file contains ONLY the following:

This is /just/ some test text *to see* if the PHP works
and to /*evaluate*/ what it actually does

The intention is that /just/ will show as italic, *to see* will show as
bold and /*evaluate*/ will show as bold italic.

Creating the text inside the page works fine.

<?php
$s = 'hello. /this/ works *bolding* works. /*Both work*/!'
$search = array ( '@/(.*?)/@si',
'@*(.*?)*@si');
$replace = array ( '<i>1</i>',
'<b>1</b>');
echo preg_replace($search, $replace, $s);
?>

However when I try and read from a text file using

$s = file('./wiki.txt');
$search = array ( '@/(.*?)/@si',
'@*(.*?)*@si');
$replace = array ( '<i>1</i>',
'<b>1</b>');
echo preg_replace($search, $replace, $s);
?>

All that is shown is the single word 'Array'. This confuses me a lot as

<?
$s = file('./test.txt');
print_r($s);
?>

shows that the text is being read into the page
Array ( [0] => This is /just/ some test text *to see* if the PHP works
[1] => and to /*evaluate*/ what it actually does )

A Crazy PHP, CSS, JS Error In Style Switching...
I've been doing A LOT of work on my site over the past few days as I've REALLY broken in to PHP (with the very fine help of the folks here at WW).

My site uses themes that were applied on links when you enter the site by using onmousedown and the hyperlinks and then in order to ensure the user still got in to the site onmouseup would change the url location.

However this presented a roadblock to IE users to which I had to add a big red box explaining how you had to slowly lift your mousebutton back up after waiting a second after pressing it. High-tech $h!t for IE users and one guy who tried to trash me in my own guestbook even IoI...

So I needed a better way to apply the themes to my site and remove the hidden JS intended to give a message only for IE users who of course are effected by that method. After I added the message coincidentally my rank in google again plumeted from page 3 to page 11 (go figure).

Coincidentally I had learned how to set cookies with PHP just a few days earlier. Now my site sets cookies based on which frameset file is loaded. So I evnetually got the idea that I could have PHP detect the bandwidth setting (bandwidth and audio settings are saved by the cookie when the user enters the site by choosing their preferences) by looking at the cookie.

Well it worked...kinda. Once you enter my site and wander to the Themes page if you try to use a theme intended for the opposite bandwidth (dialup/broadband) some wacky stuff happens...

If you enter the site via dialup everything works fine with the themes. However if you choose broadband you start to notice stuff.

For example the dialup versions of the stylesheets are W3 compliant versus the broadband versions include cursor and scrollbar enchancements for IE. These will be applied if you use broadband on IE and choose a dialup version of a theme.

You'll also notice the icons are loaded when you choose dialup though they should NOT load from dialup stylesheets ever.

There is also a matrix background image for the broadband theme (that I've grown to hate thanks to crappier comps then mine but haven't yet removed) that only loads when you DO choose the broadband version of the Matrix theme. So a contradiction to a contradiction?

This leads me to believe that somehow ONLY when you choose broadband do the themes get mixed up. Yet if you choose the matrix dialup theme the background image does not load.

Now the only guess I have is that since the dialup themes are intended to be as slim as possible to make the site load much quicker the classes for the icons are being overwritten by the broadband stylesheets since the PHP writes the default stylesheet if you choose broadband.

That would be because (I think) if you have two stylesheets and one class is better defined on sheet B then sheet A even IF you're trying to use JUST sheet A it will still load stuff based on B. Thats my current theory of whats happening. But if I add the classes I will negate an additional 2 seconds of load time for dialup users who think they have broadband ... ahh aol users I mean.

PHP Style Switcher - Browser Problems
I posted about this a few days ago, and I got a few suggestions that
fixed part of my problem.

I am using a PHP script to switch external style sheets when the viewer
clicks on the style link. Search "Amanda H." in this group and you can
view my last post to see the original PHP and html junk. This below is
the updated link rel and the meta tags.

Before, it wouldn't refresh or change in Opera, Firefox, or IE6/Win &
IE5/Mac. The bits added on to the link rel and adding the meta tags
worked for Firefox and Opera.

In IE6/Win, the style sheet loads, but a manual refresh makes it
actually load. In IE5/Mac, the style sheets won't switch at all. I
don't know PHP very well, so I don't know what the problem could be.
Here's the script and code:
-------------------------

<?
header('Content-Type: text/css');
// CONFIGURATION
// If you want to specify a default CSS file for users who can't handle
// cookies, replace styles.css with the filename below:
$basicsheet = "basic.css";
// CHECK IF NEW STYLESHEET IS BEING LOADED
if(isset($_GET['sheet']) OR isset($_POST['sheet'])) {
// CHECK IF FILE IS SPECIFIED IN URL
if(isset($_GET['sheet'])) { $newsheet = $_GET['sheet']; }
// CHECK IF FILE IS SPECIFIED IN FORM DATA
if(isset($_POST['sheet'])) { $newsheet = $_POST['sheet']; }
// MAKE THE USER REMEMBER WHICH STYLESHEET IS LOADED
setcookie("my_stylesheet", "$newsheet.css", 0, "/");
// SEND THE USER BACK
$ref = $_SERVER['HTTP_REFERER'];
header("Location: $ref");
} else {
// NORMAL STYLESHEET REQUEST
$mysheet = $_COOKIE['my_stylesheet'];
if($mysheet == "") { $mysheet = $basicsheet; }
include "$mysheet";
}
?>
-----------------------------------------
Then the new link header & meta tags for the HTML file:

<link rel="stylesheet" type="text/css"
href="http://www.amandahenson.com/styleswitcher.php?<?php echo time();
?>" />

and

<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />

It works in most browsers, but it still has those problems with the browsers mentioned above.

Change Font Style In PDF-files
I'm trying to change the font style for Tahoma from normal to italic.
I inserted Tahoma and TahomaBD.
But I can't find anything about changing the style, but underline...

Version Control Philosophy And Style
I am trying to figure out how to use Subversion, but this question isn't
really Subversion-specific. Any version control system will suffer from
the same problem, IMO.

I've crossposted to those groups I've deemed most relevant WRT web
development. (Well, relevant to *me*). I don't think this question will
be completely relevant in a C/C++ or other local devlopment environment.
Maybe it is...

So, in using Subversion, I have imported a webapp directory tree "into"
Subversion.

I have then "checked out" a copy of the webapp into a development
directory. (This is a PHP+Apache+MySQL app, btw).

Now, to test, I have a LAMP environment installed *locally* and I access
the webapp locally (the cheked out copy) using
http://localhost/path/to/webapp/

Now, the question comes down to configuration details and "pushing" the
thing to the live web server. The local LAMP config and the "live" SAMP
config (the live server is on Solaris) are quite different from each other
as far as naming of paths and whatnot on the server.

There *is* a config file in the webapp hiearchy! Changing that file
easily makes the webapp point all of its various pieces to the correct
paths and files on the server.

But the config file has to be different on the working copy than on the
server!

How can a version control system deal with this problem without me having
to tweak the "live" config file every time I migrate the app from the
Subversion repository to the live server?

Any general insight at all would be appreciated. I have worked as a web
developer for quite a while now, but never have used a VCS before. I'm
sure it is not a new question! But how does one Google on so esoteric a
concept?

Parsing CSV-file And Adding CSS To Style
I'm parsing a CSV-file into a table on a webpage - and I'd like to be
able to change the alignment for the _last_ <td> in each <tr> - but, as
the file is today, it's not possible for me to assign a CSS-class on
only the last <td>. I was wondering if anyone could give me a clue as to
what I need to change in the following code, to make this possible (I'm
assuming I need to have each <td> present in the code, so as to be able
to assign a class to the last one, but how? I can tell as much as that I
know the number of <td>'s in each CSV-file - they are a constant).

Here is the code:

<?php
class csv{
/* This class builds a html table from the contents of a CSV file. */

var $html = ''

function csv($csvFile){
if(!$csvHandle = fopen($csvFile, 'r')){
$this->html .= "Couldn't open $csvFile.";
}
else{
$this->html .= "<table id="dusjkabinetter">
<thead><tr>

<th id="th2" valign="top" align="left">Prod. nr:</th>

<th id="th3" valign="top" align="left">Bilder:<br />(klikk
for større visning):</th>

<th id="th4" valign="top" align="left">Beskrivelse:</th>

<th id="th5" valign="top" align="left">Pris:</th>

</tr>

</thead>
";
while(($row = fgetcsv($csvHandle, filesize($csvFile))) !== false){
$this->html .= "<tr>";
foreach($row as $field){
$this->html .= "<td>$field</td>";
}
$this->html .= "</tr>
";
}
fclose($csvHandle);
$this->html .= "</table>

";
}
}

function getHtml(){
return $this->html;
}
}

echo <<<TABELL_START
<div class='t_tabell'>
TABELL_START;

$html .= "<h2>Dusjkabinetter</h2>
";
$mycsv = new csv('csv-filer/dusjkabinetter.csv', ' ');
$html .= $mycsv->getHtml();

echo $html;

echo <<<TABELL_SLUTT
</div>
TABELL_SLUTT;
?>

Pre-coding
I need some advice on feasability etc on using PHP (MySQL backend) for a little project that I have in my mind. I'm new to PHP, but not programming (thank God!) - so barring syntax, logic should be fine (I hope), but I'm unsure if PHP has the ability to do what I need (told you I was a newbie eh?? )

The project ....
Simply put, the idea is for a series of drop down boxes to kinda act as a "filter"for data in the records in a mysql db. Ie, lets say for example that my db contains info about cars, with the columns, Make, Model, CC, Colour etc etc.

Initially the user would see (in the above example), 4 drop down boxes, each with data pulled from the db relevant to their column id. The pulling of data I dont have a problem with - thats sorted. However, in the brief coding exercises I've done, its the ability to have a user choose any of the four drop boxes, and all the other 3 dropdown boxes data be ammended ? Am I explaining this well ?

Lets say that I choose 'Red' from the Colour drop down - then the drop down box for Make should change to only be Makes where colour = red, Model should also change to where colour = red etc etc etc ? With me here ?

At any point the user will have the ability to 'go' their selection - and all the records are displayed for the user. Am I wanting too much here from PHP? I've been told JScript would do what I need (better than PHP?????) but frankly I dont have the time to start learning another lang, so if this can be done in PHP I'd be happy.

Howto Use Tags Like Style Codes For Forum
How to use codes like [img]http://blablah.com/pic.jpg[/img]?

Reg Exp Question: Removing Class And Style From Html
i have a little database driven content managment system. people can
load up html-docs. some of them use ms word as their html-editor,
which resultes in loads of "class" and "style" attributes - like this:

<p class="MsoNormal">Some text</p>

now i'd like to remove them (the attributes, not the people, that is).
i know reg exp is the way, but somehow the solution avoids me.

Flat File List Style Menu
I'm trying to build a Menu Building out of flatfiling with a section to add new areas to it.  The idea behind it is to have a header for each section (as the top order list item) then each one below is a link of that category.

I already figured I'm buillding it with limits (20 items Max per heading) and that to do it I will simply have each Heading/links in it be a new row in the document.  example row Tips tips.php Tips on Php, file tips File Tips tips/files.php, etc etc

With the first item of each row being the Heading and each other being the ones under it My question is What delimiters should I use to seperate in the row (I need to separate each item by 1 delimiter and then in each row separate the href, alt, name)

Secondly for rewrtiign it should I simply write it so each time it rewrites the whole file or should  I try and do string replacing and do modify sorta deal.

Generating 1, 1.1, 1.1.2 Style Numbering From Infinite Array
I have a directory listing function that runs through a given dir and dumps results into an array thus:

[6] => Array .....

Best FTP Client For Coding PHP
I currently use Eclipse for creating the PHP application, which is
great for editing but quite slow when using FTP. But when im testing i
like to use CuteFTP Pro for quicky editing and seeing the results. Im
getting fed up with CuteFTP as its really flakey.

I am looking for a simiar application like CuteFTP that has an inbuilt
editor but can not find one, every one I have looked at uses a
different application to edit.

Can anyone recomend a FTP editor that works well with quickly editing
PHP web applications?

Coding Methods
Im trying to figure out some better coding methods. Maybe you more experienced guys can help me. Right now im working on a new site which is a bit larger than i usually do. Currently i have a main Index.php file which has functions which call functions that display html (footer.php, header.php, main_table.php). And inside these include files, i have php code which call him mysql functions, etc, etc.

But after looking at for awhile, i can see some forseeable problems. What are some good coding methods that can help me code better and make it easy for me to update the code with out having to rewite everything.

Bad PHP Coding Practices?
I'm just wondering what are some bad (inefficient / resource intensive) PHP coding practices. For example, in Visual Basic string concatenation in a loop can really slow things down since a new string is created each time. Object creation has overhead and only so many objects can be created before it bogs down. Any significant problems with $a .= $a + "text" or objects in PHP? Any other bottlenecks?

Removing PHP Coding
I have php coding that is stored in mysql blobs. Now I want to index words in these blobs in an attempt to make some sort of a search engine. Example: How can I use php to make this mysql text:

"Once upon a time there were <?php echo $num_bears ?> bears in a small cage in a zoo in Russia. They had <?php echo $num_relatives ?> relatives that lived there with them."

Change into this: "Once upon a time there were bears in a small cage in a zoo in Russia. They had relatives that lived there with them."

Point is: - remove everything between and including "<?php" and "?>" I'm trying to do some indexing, and I need to remove all my php coding... :)

Coding Convention
Consider the following code (contained in a class method):

switch($sectionType)
{
case 'layout':
return $this->getLayoutSection($sectionName);
break;
case 'content':
return $this->getContentSection($sectionName);
break;
}

Obviously neither break is going to get execute, because the method will
return before it gets to them.

I have gotten into the habit of putting breaks at the end of every case in a
switch, even if it is not necessary (as the above). I have it somewhere in
the back of my head that this is the "proper" way to do things. But now
that I think about it, I have to ask, is this true? Is it consider good
practice to always end case statements with a break, even when not
necessary?

Anyone Use UltraDev For Php Coding?
I'm considering using Dreamweaver for general web design and have seen that UltraDev can be extended to use php. Has anyone had experience of this and if so, what are the good/bad features of this? In particular, I would want to create code that accesses a mysql database. I currently do all this by hand.

Is This Bad Coding Practice?
After recently coming back to php after working in asp for several
years, I want to do things well, so I'm very concerned with learning
good coding practices.

Also I'm trying to seperate logic from presentation as much as I can
through the use of the <?=$variable_output_goes_here?> output. I'll
give you an example.

Instead of putting the body of a for loop (that displays info from an
array in a table), in the html, I'll declare a variable and put
everything in the variable.

<?php

$display_results = '<table>'

for ($i = 0; $i < 3; $i++) {
$display_results .= '<tr><td>' . $info[$i][0] . '</td><td>' .
$info[$i][1] . '</td><td>' . $info[$i][2] . '</td></tr>'
}

$display_results .= '</table>'

?>

Then I'll output into the html like so . . .

<?=$display_results?>

My question is, even though this seems to work, now I'm learning on a
small scale at home. If I take this sort of coding habit to a
production enviornment, is it going to slow down my code if I need to
scale something up? If I'm this interested in logic/presentation
seperation, would I just be better off using smarty?

Standard Coding...
I was wondering if there is a standard when mixing PHP and HTML script on a
page... and if there were any articles on this subject...

i.e. do I make every page a .php page on my website and echo html when I
need to or...

should I make every page html and embed php when I need to..

Obviously this only applies to pages where a mixture of php and html is
required...

for example... which is better or more standard....

<html>
<head>
<title>title text</title>
</head>
<body>
You name is <?php $name?>
</body>
</html>

saved as index.html

or

<?php
echo '<html>'
echo '<head>'
echo '<title>title text</title>'
echo '</head>'
echo '<body>'
echo 'Your name is '.$name;
echo '</body>'
echo '</html>'
?>

saved as index.php

Best Coding Practice
let me say that this question is a rather general programming
question, but the context is PHP, so I figured this group would have
the most relevant insight.

Anyways, this is also more of an opinion based question than one
seeking a definite answer. Recently, while maintaining a rather large
system. I needed to add an array class member to an object. It was
exactly the same as another class member, except that one array stored
regular products, and the other stored free promotional products. As
such, I needed a way to add products to the new, free array. Since all
the logic was the same between the two arrays aside from the price, I
had a few different options to do this. I'm interested in polling
which way some of the group members feel would have been the best.
Naturally these are abbreviated versions of what I envisioned as
possible solutions.
#1.
public function addArrayA($object){
//logic
$a[] = $object;
}

public function addArrayB($object){
//same logic
$b[] = $object;
}

#2. (These next two are arranged as such, because the class using
these functions is included in many script files,
all of which I may not be aware of, so there would have to be some
default value for the array that was always used
before this new array was needed)
public function addArray($object, $free = NULL){
//logic
if(!$free){
$a[] = $object;
}else{
$b[] = $object;
}
}

or

#3
public function addArray($object, $arr = "a"){
//logic
$$arr[] = $object;
}

I ended up going with option number 1, because I felt that despite the
inefficient, redundant code it would later be more readable to other
programmers that might work on the project. Additionally, I didn't
feel wholly comfortable with default variables being the only
difference between a full price product and a free product. Thoughts?

Streamline PHP Coding
This script was build to take a ZIP file that has been uploaded to our server, extract the TXT files within (which are always the same) and INSERT the contents of those TXT files into a MySQL DB that we have setup. Is there a way to stream line this coding and help it run faster? One of the TXT files in the ZIP has over 600,000 records and takes nearly two minutes to INSERT into the DB. Code:

Coding Standards For PHP
I've picked up much of my PHP coding from various tutorials scattered about the web. I'm proficient in my coding but believe that my method isn't up to conding standards. Can you refer me to sites which use good coding methods/standards? Or is there a good reference site (other than php.net)?

Coding XHTML
I was wondering what the correct way to integrate xhtml into php? Do you design you your entire site with the xhtml inside of php or only embed the xhtml in php when necessary? For instance would you put your entire xhtml output and php with in a variable and echo it out all at once.  Or does it really depend on the situation?

Different Style/color In Header And Main Section Of A Page
I have a webpage with a header and main section. The header includes a small navigation bar. I would like the text and link color in the header be different from that in the main part. How can I do that?

Change Format Style For Datetime Data Type
I don't know how to change the default format style for datetime data type.

When I retrieve data from a table the datetime fields are displayed as "day_number month_name Year" but I need it to be displayed as normal form: "month/day/year".

I have been trying to do it using setlocal, but I don't know how to use it.

MySQL, Time() And Usinx Dates Unix Style
I have a field in my DB that saves the date/time as a integer.
I get the time on my server using the time() function.

now, moving away from php and looking at (My)SQL only.
If I use functions like DATE() or NOW(), I don't get a Unix value, (but
rather a formatted date).
So I cannot use those functions to check against my saved value.

How can I run a query that would get, say, 1 hour before the current time?

Looking For A Forum-style Text Editor With BB Code Buttons
I've been hunting around the Internet for a few hours looking for a text editor with BB code buttons, similar to ones you'll find in basic forums. I've tried several WYSIWYG editors, but they're just too advanced and don't always function how I'd like them to.

I'm looking for something simple, but flexible; something that works in virtually any browser.

Ajax Yahoo,MySpace,Live Style Search?
I have been looking for a example all day for how to do either a drop down choice search like myspace, or the kind that the yahoo, live search engines use where you can click a section and it changes, with the button to say. "Video Search" on the button, and would search that if some one was to search for something..

Highlight_string Coding Problem
Here's my goal. There's a textarea box, where I type text. I created a ubb code, [table] where it shows a brown table. This is where I'll have my PHP code. My goal is, the text between the [table] and [/table], I want the text to be in a highlight_string() function.

Simple Wiki As PHP Coding Example?
I'm currently learning PHP using the ORA "cuckoo" book. I'm looking for
some reasonably interesting sample code to read and thought that a
*simple* Wiki could be ideal. Can anyone recommend a Wiki which
implements the basic functionality only to keep things simple, written
in nice clear PHP code? I'm hoping that a couple of hundred lines or
less of PHP will suffice to get a basic wiki running, without resorting
to obfusticated coding contest tactics...

Coding Standards Without Control?
A recent poll asked if programming standards are used by development
organisations... and if they are controlled.

None: 20%
Yes, but without control: 49%
Yes, with control: 31%

Participants: 369

A majority of the participating organisations have coding standards...
and a majority does not control them ;o) What is the situation at your
location?

Want Php Coding/script For Timing
Any one know about coding/script which can show the different between two time for example the orignal time is 2:00PM and the current time is 2:30PM so the result will be 30 mintues...


Copyright © 2005-08 www.BigResource.com, All rights reserved