PHP similar to ASP.NET

1 view
Skip to first unread message

Cecil Champenois

unread,
Aug 25, 2010, 1:14:11 PM8/25/10
to PHP Group
Except for the markup language, and drag and drop controls, PHP and C#/ASP.NET seem very close in language and functions.
 
The only thing I'd like to see added to PHP would be the dragging and dropping of controls from a control toolbar like is done in Visual Studio.NET. I also like the idea of the MasterPage in .NET, which can be mimicked in PHP with a Header, Footer, and CSS added in.
 
Questions:
(1) Is it necessary to use a page like Page.Inc as is done in the book titled: PHP and MySQL Web Development Book (4th Edition), or can you make it a regular PHP file extension and just use the include or required functions at the appropriate place?
 
(2) Is it very common in PHP to use the file extension ".inc" for setting up Header and Footer templates?
 
Cecil

Heath Aiken

unread,
Aug 25, 2010, 1:28:26 PM8/25/10
to professi...@googlegroups.com
Answers:
(1) No, it is not necessary to use an .inc file-extension for includes; .php works just as well.

(2) I think that it used to be common, but I don't know if anyone uses .inc anymore.  I've never used .inc and I've been programming in PHP for 5+ years.  In fact, I wonder if any of the IDE's I use would even recognize the .inc extension, or I would have to add the file format to the preferences...

There might be some legitimate reasons for using .inc, but I'm not aware of them.

--Heath


--
This group is managed and maintained by the development staff at 360 PSG. An enterprise application development company utilizing open-source technologies for todays small-to-medium size businesses.
 
For information or project assistance please visit :
http://www.360psg.com
 
You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To post to this group, send email to Professi...@googlegroups.com
To unsubscribe from this group, send email to Professional-P...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Professional-PHP

Robert Gonzalez

unread,
Aug 25, 2010, 1:31:04 PM8/25/10
to professi...@googlegroups.com
Personally I think the use of the "inc" file extension is moronic. Since most servers aren't set up to apply security on .inc files, if someone has the inclination to mindlessly hit your site for inc files there's a chance that they will stumble upon one and view the contents of your .inc files (since the server will serve them up as text). In my opinion, that is just dumb.

I always use .php as extensions for my PHP files. It just makes sense to me to do it that way.

As for similarities between c#.net and PHP, I'd say the strongest similarity is in syntax since they both seem to derive their structure from c/c++. As it relates to developing in the language, the drag and drop functionality of .NET, as I know it, is more a Visual Studio thing than a language thing. If you opened a plain Jane editor and started coding your c# app you wouldn't have drag and drop controls. Since DnD is primarily an IDE function then you CAN get that for PHP. In fact, there are several IDEs that support that and that even allow bindings to datasets so you can map your controls to records from a query.

Néstor

unread,
Aug 25, 2010, 2:15:15 PM8/25/10
to professi...@googlegroups.com
Besidews what Robert said, to me one of the biggest pluses for PHP is
the php.net documentation and the examples included on how to use the
different functions. 
You can read the docs but seeing an usage example is AWESOME!!!!!

Cecil Champenois

unread,
Aug 25, 2010, 2:29:42 PM8/25/10
to professi...@googlegroups.com
The authors in the PHP and MySQL book used OOP to create their Page class within the Page.inc file.
 
So, with generating PHP classes, you would use the PHP file extension?
 
Cecil



From: Heath Aiken <heath...@gmail.com>
To: professi...@googlegroups.com
Sent: Wed, August 25, 2010 10:28:26 AM
Subject: Re: [Pro. PHP Dev.] PHP similar to ASP.NET

Robert Gonzalez

unread,
Aug 25, 2010, 2:33:55 PM8/25/10
to professi...@googlegroups.com
To reiterate, I would never, NEVER, use a .inc file extension. For anything. Ever.

Javier Montani

unread,
Aug 25, 2010, 2:37:36 PM8/25/10
to professi...@googlegroups.com
ALWAYS use .php extension as a security measure.
Any other will be treated as a text file and the browser will show the content.
php files are processed by the server and will never show it content.

2010/8/25 Cecil Champenois <cecilch...@yahoo.com>

Cecil Champenois

unread,
Aug 25, 2010, 2:41:55 PM8/25/10
to professi...@googlegroups.com
Then, the book I am using is defintely outdated, because it has all these things which everyone seems to say not to do. My other book is called Beginning PHP and MySQL, from novice to professional, 3rd Edition by W.Jason Gilmore. It's an APRESS book.
 
Cecil



From: Robert Gonzalez <robert.anth...@gmail.com>
To: professi...@googlegroups.com
Sent: Wed, August 25, 2010 11:33:55 AM

Heath Aiken

unread,
Aug 25, 2010, 2:58:27 PM8/25/10
to professi...@googlegroups.com
I'm sure your book was fine at one time, but the PHP world has really embraced design strategies in the last few years. Concepts like DRY should drive your design strategy first-and-foremost.

To your question though, it sounds like the authors created a Page.inc file and it contains the class Page? Makes my skin crawl to think about it.

Robert already covered this a minute ago (MVC, views, etc.) and there are really two lines of attack that I personally use:

(1) Full blown MVC framework (personally I use Zend_Framework), which is a subject unto itself...

(2) The smaller site strategy that I employ for simpler stuff (like sites that have very a basic structure (few branches, no dynamic content):  For that, I will usually create a CreatePage() class that takes a page ID as the constructor argument, pulls the applicable link, key word, and configuration information from a DB.  I then create a header.php and footer.php file that get stuck into an include directory.  For each of my pages, I do the following:

require_once('path..to..CreatePage.php'); //All of my classes are kept above the webroot and routed through this one class
$page = new CreatePage(id);

include('includes/header.php');//the header.php file pulls variables from the PHP classes

<!-- HTML content which may pull variables from various PHP classes ----->

include('includes/footer.php');//the footer.php file pulls variables from the PHP classes

Through the CreatePage() class, I form the navigation dynamically (to consider different levels, scenarios, etc), get page titles, page headers, and maybe a page layout flag (wide, narrow, with side-bar, etc.) to trigger the appropriate CSS layout.

This way if I have to adjust anything to do with navigation it happens in the header.php and footer.php files. I NEVER duplicate code in the actual content pages this way (other than the CreatePage() object instantiation and the includes).

The CreatePage() class is essentially a factory class that instantiates the appropriate helper classes depending on what configuration flags are set in the DB.

I'm sure there are ways to further automate this process, but then you start getting into the territory of the MVC frameworks, and at that point you might as well use one of those...

Anyway, just something to compare to what you are reading to give you another approach.


--Heath

Jack Timmons

unread,
Aug 25, 2010, 5:44:17 PM8/25/10
to professi...@googlegroups.com
I'm just going to reply by myself, since most of you already ran away
with it. Consider it a gift!

On Wed, Aug 25, 2010 at 12:14 PM, Cecil Champenois
<cecilch...@yahoo.com> wrote:
> Except for the markup language, and drag and drop controls, PHP and
> C#/ASP.NET seem very close in language and functions.

Except, you know, PHP is meant to be free and available to everyone,
regardless of platform.

> The only thing I'd like to see added to PHP would be the dragging and
> dropping of controls from a control toolbar like is done in Visual
> Studio.NET.

This isn't a PHP vs. .NET thing, though. This is "I like editors for
.NET more than I do ones for PHP."

And, really, drag & drop. What, are we making websites in the
Wordpress editor now? ;)

> I also like the idea of the MasterPage in .NET, which can be
> mimicked in PHP with a Header, Footer, and CSS added in.

MasterPage? Unfamiliar with the term. But if it's anything like the
Master Sergeant, I'm going to have to tell you that I didn't care for
Halo.

See what I did there?

> (1) Is it necessary to use a page like Page.Inc as is done in the book
> titled: PHP and MySQL Web Development Book (4th Edition), or can you make it
> a regular PHP file extension and just use the include or required
> functions at the appropriate place?

.inc? Close your Netscape Navigator browser, my friend, and move
forward into the Millennium!

Real Men© stick with good ol' PHP. Except me, I have .ctp templates
since I use Cake. It would kinda make me cry if I weren't too busy
using a live tiger's mouth to shave my backhair.

> (2) Is it very common in PHP to use the file extension ".inc" for setting up
> Header and Footer templates?

About as common as it is to marry your sister, have a genius baby, and
go on to win the gold medal in debauchery.

You're not taking my medal from me.

--
Jack Timmons
@_Codeacula
Feel free to contact me on GTalk.

Robert Gonzalez

unread,
Aug 25, 2010, 7:16:44 PM8/25/10
to professi...@googlegroups.com
I'm pretty sure the need for a "National Jack Timmons Hall of Fame, Quote Division" just grew by orders of magnitude.


On Wed, Aug 25, 2010 at 2:44 PM, Jack Timmons <code...@gmail.com> wrote:
It would kinda make me cry if I weren't too busy
using a live tiger's mouth to shave my backhair.

On Wed, Aug 25, 2010 at 2:44 PM, Jack Timmons <code...@gmail.com> wrote:
About as common as it is to marry your sister, have a genius baby, and
go on to win the gold medal in debauchery.

You're not taking my medal from me.

Best. Quotes. Ever.

Jack Timmons

unread,
Aug 25, 2010, 9:04:06 PM8/25/10
to professi...@googlegroups.com
On Wed, Aug 25, 2010 at 6:16 PM, Robert Gonzalez
<robert.anth...@gmail.com> wrote:
> I'm pretty sure the need for a "National Jack Timmons Hall of Fame, Quote
> Division" just grew by orders of magnitude.

We need one of those.

I'm thinking in the Senate, except that room is full of sissies.

> On Wed, Aug 25, 2010 at 2:44 PM, Jack Timmons <code...@gmail.com> wrote:
>>
>> It would kinda make me cry if I weren't too busy
>> using a live tiger's mouth to shave my backhair.
>
> On Wed, Aug 25, 2010 at 2:44 PM, Jack Timmons <code...@gmail.com> wrote:
>>
>> About as common as it is to marry your sister, have a genius baby, and
>> go on to win the gold medal in debauchery.
>>
>> You're not taking my medal from me.
>
> Best. Quotes. Ever.

Glad you appreciated them.

Need something to drive the points home.

--
Jack Timmons
@_Codeacula

bradleylamar

unread,
Aug 26, 2010, 11:51:31 AM8/26/10
to Professional PHP Developers
I still use .inc files on occasion. It shouldn't be a security concern
as some have said b/c none of your mvc files should be inside your web
servers doc root. The only php file usually inside the doc root on any
of my sites is index.php. That is the best practice for security. I
use .inc files for static html templates that might be repeated often
across a site. So if your footer doesn't need to be dynamic and use
php I would have a footer.html.inc file that I included in my other
view templates. Also I use .inc files for constants. I've been moving
some of my constants to an interface lately, but I still sometimes
use .inc files for constants that I need sitewide (basically those I
need in php cron scripts also).


On Aug 25, 12:14 pm, Cecil Champenois <cecilchampen...@yahoo.com>
wrote:

Muita Wangoko

unread,
Aug 26, 2010, 5:21:43 PM8/26/10
to professi...@googlegroups.com
On Thu, Aug 26, 2010 at 01:16, Robert Gonzalez <robert.anth...@gmail.com> wrote:
I'm pretty sure the need for a "National Jack Timmons Hall of Fame, Quote Division" just grew by orders of magnitude.
 
@Robert,

I think Jack is in the wrong career! ... :)

+-------------------------------------------------------------------------------------------------------+
 Best Regards,
 ./Muita Wangoko

 "If the outside is so good, why is it taking too long to perfect the inside?"
 +-------------------------------------------------------------------------------------------------------+

Cecil Champenois

unread,
Aug 25, 2010, 1:38:44 PM8/25/10
to professi...@googlegroups.com
I'd like to know more about the drag n drop (in the IDE) capabilities for PHP. Who are the vendors that make these IDE's? I am assuming that these IDE's are not quite free, right?
 
Cecil



From: Robert Gonzalez <robert.anth...@gmail.com>
To: professi...@googlegroups.com
Sent: Wed, August 25, 2010 10:31:04 AM

Subject: Re: [Pro. PHP Dev.] PHP similar to ASP.NET

Robert Gonzalez

unread,
Aug 30, 2010, 1:42:41 AM8/30/10
to professi...@googlegroups.com
I'll look through my bookmarks tomorrow to see if I can find my
resources on the ones I've seen.

On Wednesday, August 25, 2010, Cecil Champenois


<cecilch...@yahoo.com> wrote:
>
> I'd like to know more about the drag n drop (in the IDE) capabilities for PHP. Who are the vendors that make these IDE's? I am assuming that these IDE's are not quite free, right?
>  Cecil
>
>
>
>
>

> From: Robert Gonzalez <robert.anth...@gmail.com>
> To: professi...@googlegroups.com
> Sent: Wed, August 25, 2010 10:31:04 AM
> Subject: Re: [Pro. PHP Dev.] PHP similar to ASP.NET
>
> Personally I think the use of the "inc" file extension is moronic. Since most servers aren't set up to apply security on .inc files, if someone has the inclination to mindlessly hit your site for inc files there's a chance that they will stumble upon one and view the contents of your .inc files (since the server will serve them up as text). In my opinion, that is just dumb.
>
> I always use .php as extensions for my PHP files. It just makes sense to me to do it that way.
>
> As for similarities between c#.net and PHP, I'd say the strongest similarity is in
> syntax since they both seem to derive their structure from c/c++. As it relates to developing in the language, the drag and drop functionality of .NET, as I know it, is more a Visual Studio thing than a language thing. If you opened a plain Jane editor and started coding your c# app you wouldn't have drag and drop controls. Since DnD is primarily an IDE function then you CAN get that for PHP. In fact, there are several IDEs that support that and that even allow bindings to datasets so you can map your controls to records from a query.
>
> On Wed, Aug 25, 2010 at 10:14 AM, Cecil Champenois <cecilch...@yahoo.com> wrote:
>
>
>
>

> Except for the markup language, and drag and drop controls, PHP and C#/ASP.NET <http://asp.net/> seem very close in language and functions.
>
> The only thing I'd like to see added to PHP would be the dragging and dropping of controls from a control toolbar like is done in Visual Studio.NET <http://studio.net/>. I also like the idea of the MasterPage in .NET, which can be mimicked in PHP with a Header, Footer, and CSS added in.


>
> Questions:
> (1) Is it necessary to use a page like Page.Inc as is done in the book titled: PHP and MySQL Web Development Book (4th Edition), or can you make it a regular PHP file extension and just use the include or required functions at the appropriate place?
>
> (2) Is it very common in PHP to use the file extension ".inc" for setting up Header and Footer templates?
>  Cecil
>
>
> --
> This group is managed and maintained by the development staff at 360 PSG. An enterprise application development company utilizing open-source technologies for todays small-to-medium size businesses.
>
> For information or project assistance please visit :
> http://www.360psg.com
>
> You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
> To post to this group, send email to Professi...@googlegroups.com
> To unsubscribe from this group, send email to Professional-P...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/Professional-PHP
> --
> This group is managed and maintained by the development staff at 360 PSG. An enterprise application development company utilizing open-source technologies for todays small-to-medium size businesses.
>
> For information or project assistance please visit :

> http://www.360psg.com <http://www.360psg.com/>

Robert Gonzalez

unread,
Aug 31, 2010, 11:30:10 AM8/31/10
to professi...@googlegroups.com
Ok, I feel a little sheepish, but this is the only one I remember. I saw it at ZendCon last year and was a little impressed by it. Seemed neat at the time and looks a little better now than it did last year.

Jimboidaho

unread,
Aug 31, 2010, 1:36:18 PM8/31/10
to Professional PHP Developers
Wow. That product is expensive. 1300.00 unless I go back to school
then 98.00.

On Aug 31, 9:30 am, Robert Gonzalez
<robert.anthony.gonza...@gmail.com> wrote:
> Ok, I feel a little sheepish, but this is the only one I remember. I saw it
> at ZendCon last year and was a little impressed by it. Seemed neat at the
> time and looks a little better now than it did last year.
>
> http://www.embarcadero.com/products/delphi-for-php
>
> On Sun, Aug 29, 2010 at 10:42 PM, Robert Gonzalez <
>
> robert.anthony.gonza...@gmail.com> wrote:
> > I'll look through my bookmarks tomorrow to see if I can find my
> > resources on the ones I've seen.
>
> > On Wednesday, August 25, 2010, Cecil Champenois
> > <cecilchampen...@yahoo.com> wrote:
>
> > > I'd like to know more about the drag n drop (in the IDE) capabilities for
> > PHP. Who are the vendors that make these IDE's? I am assuming that these
> > IDE's are not quite free, right?
> > >  Cecil
>
> > ASP.NET <http://asp.net/> seem very close in language and functions.

Robert Gonzalez

unread,
Aug 31, 2010, 3:50:17 PM8/31/10
to professi...@googlegroups.com
I think they were giving away student licensing coupons last year at ZendCon. I'll be there again this year. If they are I can try to snag some if anyone is interested.

Jimboidaho

unread,
Aug 31, 2010, 4:17:54 PM8/31/10
to Professional PHP Developers
I was thinking about downloading the trial version to test. I am
getting along well with Eclipse except I can't the the debugger to
stop at a break point.

I would definitely be interested in a coupon.

Thanks.

On Aug 31, 1:50 pm, Robert Gonzalez
<robert.anthony.gonza...@gmail.com> wrote:
> I think they were giving away student licensing coupons last year at
> ZendCon. I'll be there again this year. If they are I can try to snag some
> if anyone is interested.
>

Cecil Champenois

unread,
Aug 31, 2010, 6:34:21 PM8/31/10
to professi...@googlegroups.com
Yes, I am definitely interested.
 
Cecil



Sent: Tue, August 31, 2010 12:50:17 PM
Subject: Re: [Pro. PHP Dev.] Re: PHP similar to ASP.NET

Robert Gonzalez

unread,
Aug 31, 2010, 7:57:37 PM8/31/10
to professi...@googlegroups.com
Ok, if I can get my hands on anything for you guys I will. The conference isn't until the first week of November so you'll have to wait till then.

Jimboidaho

unread,
Aug 31, 2010, 8:20:09 PM8/31/10
to Professional PHP Developers
Thanks.

On Aug 31, 5:57 pm, Robert Gonzalez
<robert.anthony.gonza...@gmail.com> wrote:
> Ok, if I can get my hands on anything for you guys I will. The conference
> isn't until the first week of November so you'll have to wait till then.
>
> On Tue, Aug 31, 2010 at 3:34 PM, Cecil Champenois <cecilchampen...@yahoo.com
>
> > wrote:
> > Yes, I am definitely interested.
>
> > Cecil
>
> >  ------------------------------
> > *From:* Robert Gonzalez <robert.anthony.gonza...@gmail.com>
>
> > *To:* professi...@googlegroups.com
> > *Sent:* Tue, August 31, 2010 12:50:17 PM
> > *Subject:* Re: [Pro. PHP Dev.] Re: PHP similar to ASP.NET
>
> > I think they were giving away student licensing coupons last year at
> > ZendCon. I'll be there again this year. If they are I can try to snag some
> > if anyone is interested.
>
> >> > > ASP.NET <http://asp.net/> <http://asp.net/> seem very close in
> >> language and functions.
>
> >> > > > The only thing I'd like to see added to PHP would be the dragging
> >> and
> >> > > dropping of controls from a control toolbar like is done in Visual
> >> > > Studio.NET <http://studio.net/> <http://studio.net/>. I also like the
Reply all
Reply to author
Forward
0 new messages