473,788 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best programming method?

46 New Member
Hi

I'm trying to build a website, but right now I'm just thinking how to start. I know how PHP works but I'm wondering which is the best way so I need your advice.

I OO programm as much as I can, but sometimes I get confused. Now for example

if(something){
//some text
} else {
//some text
}

should I write the real text instead of some text, like forms, inputs, basically simple html, but in this case I need to create header (<html><head>.. .) and I can say goodbye to header() function because headers will already be sent. So I was thinking (I already did this with my cms) to pack all html and text into something like $output and just add them later with code. And then on the end I include template and just echo out the code. But I'm not sure how fast is this and I still need to make some html design in code. because I'm only making new variables and they can be exploided, well I think so. As I know, template systems work like this, but I'm not big fan of them. So what do you suggest? Should I read some artictes how to start a big object so that I don't get lost in the middle.... I'm trying to find the best way to separate html and php, so that I have the cleanest php code as possible...

thanks
Nov 19 '07 #1
2 1054
r035198x
13,262 MVP
Hi

I'm trying to build a website, but right now I'm just thinking how to start. I know how PHP works but I'm wondering which is the best way so I need your advice.

I OO programm as much as I can, but sometimes I get confused. Now for example

if(something){
//some text
} else {
//some text
}

should I write the real text instead of some text, like forms, inputs, basically simple html, but in this case I need to create header (<html><head>.. .) and I can say goodbye to header() function because headers will already be sent. So I was thinking (I already did this with my cms) to pack all html and text into something like $output and just add them later with code. And then on the end I include template and just echo out the code. But I'm not sure how fast is this and I still need to make some html design in code. because I'm only making new variables and they can be exploided, well I think so. As I know, template systems work like this, but I'm not big fan of them. So what do you suggest? Should I read some artictes how to start a big object so that I don't get lost in the middle.... I'm trying to find the best way to separate html and php, so that I have the cleanest php code as possible...

thanks
Separating html code from PHP code is the golden rule.
If templates best help this then you might as well use them.
Nov 19 '07 #2
FrEaKmAn
46 New Member
Separating html code from PHP code is the golden rule.
If templates best help this then you might as well use them.
I understand that templates are sometimes handy, like when we are editing whole page, but I'm not sure how this effects load time...

for example, how could I separate php and html in while loop?

while(something ){
echo '<li class="someclas s"><img src="some_image .jpg">'.$someth ing.'</li>';
}

?? Because if I want to change something, I need to change main file and not template, unless if I somehow include while loop in template...
Nov 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

18
2455
by: Roman Suzi | last post by:
;-) Just type into google "best programming language" and press (I am lucky) Sincerely yours, Roman Suzi -- rnd@onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
4
2164
by: Chuck Ritzke | last post by:
I keep asking myself this question as I write class modules. What's the best/smartest/most efficient way to send a large object back and forth to a class module? For example, say I have a data access module that creates a large disconnected dataset from a database. I want to pass that dataset back to the calling program. And then perhaps I want to send that dataset to another class module. At first it seems that the "object oriented"...
11
9273
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
136
9460
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
3
2100
by: danavni | last post by:
i need to build a service that will accept incoming TCP/IP connections. the service should act like a "HUB" where on one side clients connect to it and stay connected for as long as they like and on the other side the service reads messages for these clients from MSMQ and sends them to already connected clients. the clients can also send information back to the "HUB" which will be parsed and sent to MSMQ. when the clients connect to this...
111
5598
by: Enteng | last post by:
Hi I'm thinking about learning C as my first programming language. Would you recommend it? Also how do you suggest that I learn it?What books/tutorials should I read for someone like me? Thanks in advance! -entengk
56
5207
by: Zytan | last post by:
Obviously you can't just use a simple for loop, since you may skip over elements. You could modify the loop counter each time an element is deleted. But, the loop ending condition must be checked on each iteration, since the Count changes as you delete elements. I would think it is guaranteed to be computed each time, and not cached. So, is this the best way?
6
17862
by: kamsmartx | last post by:
I'm new to programming and need some help figuring out an algorithm. I need to design some kind of algorithm which will help us define capacity for one of our portfolios....here's the problem explained (also see attached example): 1. The graph defines total capacity, y-axis being $, x-axis being date/time. the bars on the graph represent individual items. 2. What I need to do is place the items on the graph in an optimized manner,...
7
1711
by: Chris | last post by:
Hi All, This is a weird one but I am hoping someone can help or has some pointers, a recipe how to do the following: I have to move some code from c++ to objective-c and to do this I must remove all defined templates. I am not really a c++ guy so I have not worked with templates all that much (not really at all) and as such I don't have a good idea where to start.
4
1530
by: trullock | last post by:
Hi, Can anyone suggest the best way to go about the following... I'm tracking clicks (mouse down x,y coordinates) on a web page by using some javascript to create an XHR which sends the coordinates to a recording service, such as: /Record.ashx?X=123&Y=456
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.