 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
01-16-2008, 07:21 PM
|
#1 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
Last 5 lines of PHP code that you wrote
Hey all,
No reason at all for this thread, just pure bordem, but I'd like to know what the last 5 lines of PHP code where that you wrote.
(the 5 lines don't include comments or whitespace, just actual code)
Be honest, don't edit them at all (well, remove sensitive info) then post them here
Here's mine:
PHP Code:
// Pull the entry for the given date from the database
$items = new Item();
$where = $items->getAdapter()->quoteInto('publish = ?', $date);
$item = $items->fetchRow($where);
// Check we got a result
if ($item === NULL)
{
Alan
|
|
|
01-16-2008, 07:31 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
|
Err, I don't have five lines, unless you count whitespace. I was working on my own MVC framework, others are too advanced for me yet, and this is my last few lines:
PHP Code:
public function dispatch() { $page = $_GET['page'] or 'index'; $cmd = $_GET['cmd'] or 'index'; }
We could post once a week or so with our last five lines, it'd sure make an interesting thread, wouldn't it?
__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
|
|
|
|
01-16-2008, 07:41 PM
|
#3 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
Quote:
Originally Posted by RobertK
We could post once a week or so with our last five lines, it'd sure make an interesting thread, wouldn't it?
|
I'll go for that - will need reminding though as I can barely remember what I'm doing each day, let alone a week in advance :)
Alan
|
|
|
01-16-2008, 07:36 PM
|
#4 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Not very interesting or insightful, but there are my last five lines!
PHP Code:
else { $opml[count($opml) - 1]['count'] = 0; } }
|
|
|
|
01-16-2008, 08:59 PM
|
#5 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
PHP Code:
public function __query($sql) { $this->varScope->queryCount++; $query = odbc_exec($this->varScope->connectionID,$sql); if ($query != false)
Adding an odbc driver to my database DB
|
|
|
|
01-16-2008, 09:18 PM
|
#6 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
php Code:
interface TalkPHP_Newsletter_Interface { public function getEmail($szEmailAddress); public function addEmail($szEmailAddress); public function removeEmail($szEmailAddress); }
Just created myself an interface 
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
01-16-2008, 10:22 PM
|
#7 (permalink)
|
|
The Addict
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
|
PHP Code:
require_once (SMARTY_DIR."Smarty.class.php");
$smarty = new Smarty;
$smarty->compile_dir= "$fixpath/libs/compile";
$smarty->template_dir= "$fixpath/template/gray";
?>
bcz im learning about smarty
__________________
|
|
|
01-16-2008, 10:19 PM
|
#8 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
|
Part of Tuxxedo Forums; in /includes/functions_forum.php (construct_forumbits()):
PHP Code:
$forumdata = $tuxxedo->datastore->getDatastore('forumdata');
if(!sizeof($forumdata))
{
tuxxedo_error($phrase['no_forums']);
}
foreach($forumdata as $forum)
{
$forumdata[$forum['id']]['subforums'] = explode(' ', $forum['subforums']);
}
For those whos interested in the final source, then ill update my api docs in a moment so its avaible from:
Tuxxedo Software Development
|
|
|
01-16-2008, 10:33 PM
|
#9 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Yay more lines of code.
PHP Code:
$fetcher = new TalkPHP_Latest_Articles(); $view = new View('rss'); $view->articles = $fetcher->get_articles(); $view->render(); exit;
An interface to the newest articles here on TalkPHP so that I can subscribe to an RSS in order to keep up to date -- seeing as there isn't one already provided! 
|
|
|
|
01-16-2008, 11:14 PM
|
#10 (permalink)
|
|
The Acquainted
Join Date: Sep 2007
Location: Leeds, UK
Posts: 141
Thanks: 6
|
php Code:
)) or die(mysql_error()); // Fetch $row = mysql_fetch_array($query); return $row[ 'username']; }// Register function$smarty-> register_function('getUsernameById', 'getUsernameById');
__________________
Not quite a n00b...
|
|
|
|
01-16-2008, 11:16 PM
|
#11 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
PHP Code:
$id = $data->post("id");
mysql_query("DELETE FROM `items` WHERE `id` = '$id'") or die(mysql_error()); echo "Item deleted"; ?>
|
|
|
|
01-17-2008, 04:03 PM
|
#12 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
|
This is at the end of an xajax function, in a controller, in CodeIgniter, on an intranet application that I am working on at work... How many prepositional phrases can we squeeze into one sentence?
PHP Code:
}
}
$objResponse->addAssign('div_formwrap', 'innerHTML', $innerHTML);
return $objResponse;
}
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
|
|
|
|
01-19-2008, 11:16 PM
|
#13 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
Bill, out of interest, what do you think of CodeIgniter compared to other frameworks like Cake or Zend?
Another 5 lines from me - parts of my Zend Framework Application Generator project:
PHP Code:
$this->view->currentStep = ($_SESSION['totalSteps'] == 6 ? 3 : 4);
$this->view->totalSteps = $_SESSION['totalSteps'];
// Display the correct form based on the appType
if ($_SESSION['appType'] == 'modular')
{
$this->render('actions-modular');
Alan
|
|
|
01-19-2008, 11:29 PM
|
#14 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
Some code from the install.php file in my new CMS that is to be released on the 26th. ;)
PHP Code:
mysql_query("INSERT INTO users VALUES ('$admin', '$admin_pass', '$admin_email', '$first', '$last')");
$profile = 'This is your profile. Click the link below this box to edit it. :)';
$file = fopen("bin/users/$admin.txt","w"); fwrite($file, "$profile"); fclose($file);
|
|
|
|
01-19-2008, 11:48 PM
|
#15 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
For my signature :)
PHP Code:
/* Output the finished image */ header('Content-Type: image/gif'); imagegif($im, $dir.'cache_img.gif'); imagegif($im); imagedestroy($im);
// Write cache file_put_contents($dir.'cache_hash.txt', $cache_hash);
|
|
|
|
01-20-2008, 12:13 AM
|
#16 (permalink)
|
|
The Frequenter
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
|
Testing my session management cookie-based system.
PHP Code:
$this->Input = Registry::get( 'input' ); $this->DB = Registry::get( 'database' );
$cookies['session_id'] = $this->Input->ReadCookie( 'sid' );
if( $cookies['session_id'] === null ) { $this->init_new_session(); }
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
|
|
|
|
01-20-2008, 02:51 AM
|
#17 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
|
Quote:
|
Bill, out of interest, what do you think of CodeIgniter compared to other frameworks like Cake or Zend?
|
I have not really had a chance to use other frameworks. I am most certainly curious about them.
Code Igniter is really my first framework. I like it! The whole MVC world, once I was able to wrap my noggin around it, is a blast to work in! CI was a good intro for me to MVC. The documentation is clear enough, and the community is pretty nice over there.
I would like to try another framework out such as Cake or Zend, but I would have to say, for the couple apps I am working on right now, CI is doing just fine.
I have also wanted to try PHP on Trax. I have seen what can be done in Ruby on Rails and it interests me immensely!
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
|
|
|
|
01-20-2008, 04:25 AM
|
#18 (permalink)
|
|
The Frequenter
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
|
CI has a little bit of a CakePHP feeling (Cake is lighter, but at the same time better structured). Zend is the best object oriented framework for PHP that I have ever seen. And it's truly a framework. It doesn't do anything else but provide you with helping libraries. It's not a working system (which is good in my oppinion). After all, it has been developed by the company that supports the PHP development so...
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
|
|
|
|
01-20-2008, 07:23 AM
|
#19 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Posts: 360
Thanks: 24
|
PHP Code:
$title = get_option('ajax_comments_spy_widget_title');
$before_widget = '<li class="widget ajax_comments_spy_widget" id="ajax-comments-spy">';
$after_widget = '</li>';
if(empty($before_title)) {
__________________
Necessity is the mother of invention.
My blog
Last edited by Haris : 01-20-2008 at 11:05 AM.
|
|
|
|
01-20-2008, 10:13 AM
|
#20 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
That's never 5 lines Mr Haris!
Alan
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|