wessamzeidan Posted April 4, 2005 Posted April 4, 2005 check forums.asp.net, thats a forum done with asp.net Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
pas30339 Posted April 4, 2005 Posted April 4, 2005 Here's one major difference: PHP is loosely typed whereas all .NET languages are strongly typed. IMHO that alone is reason enough to use .NET. Also, development in .Net is significanly faster than in PHP - by orders of magnitude. This makes a HUGE difference if you're developing a large website. I've worked in PHP and .Net. The only way I'd work in PHP again is if someone paid me too. Why drive a Chevy if you can have a Mercedes? .Net simply outclasses PHP in every area. Quote
bri189a Posted April 5, 2005 Posted April 5, 2005 let me throw my stick into the hornets nest ...I think asp.net' date=' despite its higher learning curve...[/quote'] That is precisely the reason people like PHP, it's simple and doesn't require learning much. I've found that most people who have learned there PHP from message boards copying and pasting code, so when someone mentions .NET they freak because now they may actually have to learn something on there own that requires a higher learning ability... and trust me OO isn't a difficult concept... I could teach a 10 year old the basic principals so it's not so much as a learning curve but rather the ability and willingness to learn. Oh, and those other servers being more secure... If those servers were 90% of the market instead of MS, the hackers out there would gladly use that open source to pull out the vulnerablities, but there's no market for hackers in that world...so why should they focus there efforts there? People on that whole anti-MS kick really need to get a clue. Maybe some of you older folks that started long ago could describe to these folks the joys you had trying to get something to work across several differant computer systems and how at one job you might of been a 'guru' but going to another job your were a fresh fish because nothing they used was the same as your previous job. Quote
mark007 Posted April 5, 2005 Posted April 5, 2005 What does the evaluation function have to do with asp.net not being able to create a site like this one It's not so much creating a forum, as creating a templated forum as this one is responding to various options. The evaluate funcion is used to parse the templates allowing them to contain conditionals and site dependent variables. I don't believe this is possible in ASP.Net. Don't get me wrong I like ASP.Net. I just think they both have their place. As for PHP being more time consuming - I completely disagree! :) Oh and thanks for the welcome! Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Moderators Robby Posted April 5, 2005 Moderators Posted April 5, 2005 Evaluation function? A lot of you are yapping nonsense! You can create a base-class to be used as a template page... then every single item on the page yes any page can be dynamic, this includes the meta-tags, client scripts, CSS file and more. Quote Visit...Bassic Software
michael_hk Posted April 6, 2005 Posted April 6, 2005 .Net simply outclasses PHP in every area. Can you explain how .NET outclasses PHP in every area? mark007, take a look at Maverick.NET and see how ASP.NET creates the template. Quote There is no spoon. <<The Matrix>>
mark007 Posted April 6, 2005 Posted April 6, 2005 Maverick.Net doesn't seem to have anything programming related. Perhaps I best highlight the situation I'm thinking about with an example. You have a setting in the database that stores the title image path of the page. This setting is retireved from the database into a PHP variable $titleimgv and displayed on the page. The page is created from a template that perhaps has the form: <html> <Head></head> <body> <div class="title"><img src="$titleimg" /></div> <div class="content">Content goes here</div> </body> </html> If however the site owner decides to move the title image to the bottom of the page he can just edit the template to: <html> <Head></head> <body> <div class="content">Content goes here</div> <div class="title"><img src="$titleimg" /></div> </body> </html> As the template is evaluated no matter where the variable appears it is parsed. Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Moderators Robby Posted April 6, 2005 Moderators Posted April 6, 2005 Well in .NET you can have 100% of the page content come from a database. How's that for variable? Quote Visit...Bassic Software
mark007 Posted April 6, 2005 Posted April 6, 2005 Well in .NET you can have 100% of the page content come from a database. How's that for variable? You've kind of missed it. In my example both the template and the varaible would be stored in a database so would be 100% in the database. It's just the way it's organised. Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
kahlua001 Posted April 6, 2005 Posted April 6, 2005 mark007, Your example is nothing you couldnt do with old ASP with the <%= %> tags as well as in asp.net, although in asp.net, the referred method is to set these values in your codebehind, so to add that extra separation of your data and presentation. Quote
michael_hk Posted April 7, 2005 Posted April 7, 2005 Maverick.Net doesn't seem to have anything programming related. Perhaps I best highlight the situation I'm thinking about with an example. Maverick.NET does EXACTLY what you are showing in your example. Quote There is no spoon. <<The Matrix>>
mark007 Posted April 12, 2005 Posted April 12, 2005 Michael, how? do you have an example? Kahlua001, how would you execute the <% tags? I assume you are talking about something like this? <html> <Head></head> <body> <div class="content">Content goes here</div> <div class="title"><img src="<% =titleimg %> /></div> </body> </html> Now if that is stored in a database how do you then execute it to replace <% =titleimg %> with the actual data?? Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
kahlua001 Posted April 12, 2005 Posted April 12, 2005 'Code Behind Public titleimg As String 'Your datasource .. dtrReader.Read titleimg = dtrReader("titleimg") dtrReader.Close Quote
michael_hk Posted April 13, 2005 Posted April 13, 2005 do you have an example? Download Maverick.NET and browse the examples in the "examples" folder. Quote There is no spoon. <<The Matrix>>
a_jam_sandwich Posted April 13, 2005 Posted April 13, 2005 To be honest all you need on a page is a single literal and blast a template out to it. Any changable content could be replaced within the template. This works quite effectivally trust me. The only dam thing I hate about .NET it its stupid god dam editor VS2003 it has the most anoying feature every known got streight from Frontpage! It redesigns your design, make a XHML strict page in the VS2003 editor! no chance, apart from that which you can get round using an external program anyway .NET is very efficant but both languages have there place. Thanks Andy Quote Code today gone tomorrow!
mark007 Posted April 21, 2005 Posted April 21, 2005 'Code Behind Public titleimg As String 'Your datasource .. dtrReader.Read titleimg = dtrReader("titleimg") dtrReader.Close I don't think you are following, though maybe you are. Honestly, if this is doable I'd be quite pleased. (Yet to look at those exmaples you suggested michael). The code behind would look something more like: 'Code Behind Public titleimg As String Public template as String 'Your datasource .. dtrReader.Read titleimg = dtrReader("titleimg") template=dtrReader("template") dtrReader.Close How would you now insert title into the template at the relevant point and then ouput the completed template to the page? Solutions I can think of are: 1. define your own replace terms e.g. [=myvar] which you can replace using a the variable name in your code. Though for several variables this becomes several lines of code 2. More complicated - perhaps somehow use the compiler services to actually compile your template maybe.. Both of these fall well short of the simplicity of: eval("$parsedtemplate='".$template."';"); print $parsedtemplate; Any changable content could be replaced within the template. Are you meaning using a simple replace for your defined replace points at per 1 above? Or do you have something else in mind? :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Bikuri Posted May 6, 2005 Posted May 6, 2005 Maverick.Net doesn't seem to have anything programming related. <html> <Head></head> <body> <div class="title"><img src="$titleimg" /></div> <div class="content">Content goes here</div> </body> </html> If however the site owner decides to move the title image to the bottom of the page he can just edit the template to: <html> <Head></head> <body> <div class="content">Content goes here</div> <div class="title"><img src="$titleimg" /></div> </body> </html> As the template is evaluated no matter where the variable appears it is parsed. Ok, your problem is that your thinking like a PHP programmer, not an ASP.NET programmer. The way you do that in ASP.NET is: <html> <Head></head> <body> <div class="title"><asp:Image runat="server" id="titleImg" /></div> <div class="content">Content goes here</div> </body> </html> Then in your code behind you tell that asp:image control what image to load, that is if you wanted to do it dynamically anyway. You could simply set it by setting the ImageURL property of that asp:image control. Now you can move that control all around that page, doesn't matter. But technically, you could do it other ways as well. Such as: ... <div class="title"><asp:literal runat="server" id="titleImg" /></div> ... or ... <div class="title"><img runat="server" id="titleImg" /></div> ... Many ways to do it... ASP.NET is basically by default templated in the method that you are using with PHP. Quote
mark007 Posted May 6, 2005 Posted May 6, 2005 Well the difference here is that this template I am talking about is to be stored in a database rather than an aspx file. Even if it weren't there may be other scenarios where a similar template within template may occur. That is where the problem lies. Been finding it hard to put across exactly what I mean I guess. Hmm, Consider a page where I have a literal control. The Contents of this literal control are filled from a database. All is ok so far. No suppose however that this information that comes from the database contains varaibles. For arguments sake I'll use title again. A very simple template for a title might be <b>Title Here</b>. Now if I also load from the db the value of the title into a string variable How would I: a) Create the template that would contain the variable remembereing that this needs to be stored as text in the database, and b)Evaluate the template so that the variable is replaced by the actual title ? Also on a templating sort of note - the exmaples I've seen of inheriting from a custom base class that inherits Page on each page in the site although very useful for adding standard functions to the page doesn't seem that useful from a page layout point of view as you are back to making html out of strings and having to escape all the quotes...just a thought anyway.. :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Bikuri Posted May 6, 2005 Posted May 6, 2005 Well the difference here is that this template I am talking about is to be stored in a database rather than an aspx file. Even if it weren't there may be other scenarios where a similar template within template may occur. That is where the problem lies. Been finding it hard to put across exactly what I mean I guess. Hmm, Consider a page where I have a literal control. The Contents of this literal control are filled from a database. All is ok so far. No suppose however that this information that comes from the database contains varaibles. For arguments sake I'll use title again. A very simple template for a title might be <b>Title Here</b>. Now if I also load from the db the value of the title into a string variable How would I: a) Create the template that would contain the variable remembereing that this needs to be stored as text in the database, and b)Evaluate the template so that the variable is replaced by the actual title ? Also on a templating sort of note - the exmaples I've seen of inheriting from a custom base class that inherits Page on each page in the site although very useful for adding standard functions to the page doesn't seem that useful from a page layout point of view as you are back to making html out of strings and having to escape all the quotes...just a thought anyway.. :) I that case, I'd create a custom user control, build properties for the dynamic parts of it (that are filled from the database). Out of curiosity, what benegits are you looking to achieve by having your templates stored in a DB? Quote
mark007 Posted May 6, 2005 Posted May 6, 2005 The idea is that the whole site design can be changed from anywhere by simply logging into the site and changing the templates. This is how this forum works for example. :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Bikuri Posted May 6, 2005 Posted May 6, 2005 In my opinion it's better to simply create themes(templates) as files, rather than in a db. First reason, performance. It's faster to read a file local to the web server than fetch data across the network. Second, the same thing can be done... simply login, change the templates. Just because it's a file doesn't mean it's any less editable. Last, reliability. It's safer to assume (as dangerous as assumptions are in programming already) that you will be able to safely access a local file rather than a database. There are more points of failure between ASP.NET and the templates if they are stored in a DB. Of course, that's assuming the database isn't on the same server as the web server (and most often they are separate). ASP.NET 2.0 will up the ante by offering built in support for master pages and theming. Go play with the beta, beta.asp.net, and see for yourself (if you haven't already). I'm in love with 2.0! :) Quote
mark007 Posted May 6, 2005 Posted May 6, 2005 Well the db and web server are on the same server in this case. For files I would have to give people FTP access or I guess I could create some code to deal with file management for the files I wished to let people change. The idea really though is to separate functionality from style completely and although with code behind files this is mostly acheived I wouldn't want to let someone with no ASP.Net experience loose on a .aspx page. I think some of the 2.0 features could be interesting though I don't have time to play with the beta at the moment. I can of course create the effect I am after to some extent by using my own parsing - perhaps making all variables enclosed in [] etc. I have done something similar for a templated menu control I created. Seemed the only way to template it as much as I wanted to. :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Bikuri Posted May 7, 2005 Posted May 7, 2005 In essence, the interface for editing a template whether it's a file or a record in the db would be identical. I do understand what you mean by letting someone loose on an aspx page, as an error there would throw an exception� whereas the PHP eval() would simply not output something (I believe, going from memory on this). While the �war� between ASP.NET and PHP wages on for the Internet, it has already been won on my front. I now use ASP.NET exclusively. Since my switch from PHP to ASP.NET, my earnings have nearly tripled. And, while a completely personal benefit, the level of professionalism around the ASP.NET framework has �pushed� me to produce more professional code/products. Although, I do admit, the express products that are coming with ASP.NET 2.0 will �muddy the waters� a bit. But ASP.NET v2.0 is just so nice compared to v1.1, I can�t wait until it�s finally released. Quote
mark007 Posted May 7, 2005 Posted May 7, 2005 Interesting comments. I do like .Net but think PHP and .Net do both have their place. I work with both. Alot of people still and will continue to use linux web servers and while this is the case knowing both is the only option. :) Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.