473,805 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on using HTML within PHP documents

As some of you who helped with my "No input file selected" query earlier
already know, I've just started a new job and am new to PHP.

All the webpages are PHP, but contain HTML as a string definition. Which is
actually nice and easy for me as I am an HTML specialist, but am a complete
newbie with PHP.

How inadvisable is it though?

Here's what I mean:

<?php

define('NAVBAR_ TITLE', 'Shipping');

define('HEADING _TITLE', 'Shipping');

define('TEXT_IN FORMATION', '
<table width="90%" border="0" cellpadding="5" height="339">
<tr>
<td
width="20%">&nb sp;</td>
<td width="51%">
<p><font
size="7" face="Verdana, Arial, Helvetica, sans-serif"><b>Don\t know if this
is a good idea</b></font> ..........etc
........

Basically - any HTML can go here, as long as it\'s within a table, and
apostrophes are preceded by a backslash - as I have done above with the word
&quot;it\'s&quo t;
</table>

');
?>
Basically, it's just HTML that is copied and pasted into a
define('TEXT_IN FORMATION', ' string '

Which is why it ends
');
?>
What are the perils that could face me by continuing to write pages in this
fashion? Could it cause accessibility problems on some browsers?

I know it's terribly lazy but I have an awful lot of work to do and not
enough time just yet to learn good PHP skills.

Jun 16 '06 #1
5 3766
by default php will output your html as normal if you close the tags.
So instead of define('TEXT_IN FORMATION', '
with all yoru code just close the tag
?>
and write it like normal HTML. If its not inside the tags its not
parsed.

Also if you have dynamic content you want to include a quick was is
this

<div>This is <?= $name ?>'s DIV tag, isnt it cool </div>

<?= ?> works as a quick echo of whatever follows the =
Tristán White wrote:
As some of you who helped with my "No input file selected" query earlier
already know, I've just started a new job and am new to PHP.

All the webpages are PHP, but contain HTML as a string definition. Which is
actually nice and easy for me as I am an HTML specialist, but am a complete
newbie with PHP.

How inadvisable is it though?

Here's what I mean:

<?php

define('NAVBAR_ TITLE', 'Shipping');

define('HEADING _TITLE', 'Shipping');

define('TEXT_IN FORMATION', '
<table width="90%" border="0" cellpadding="5" height="339">
<tr>
<td
width="20%">&nb sp;</td>
<td width="51%">
<p><font
size="7" face="Verdana, Arial, Helvetica, sans-serif"><b>Don\t know if this
is a good idea</b></font> ..........etc
.......

Basically - any HTML can go here, as long as it\'s within a table, and
apostrophes are preceded by a backslash - as I have done above with the word
&quot;it\'s&quo t;
</table>

');
?>
Basically, it's just HTML that is copied and pasted into a
define('TEXT_IN FORMATION', ' string '

Which is why it ends
');
?>
What are the perils that could face me by continuing to write pages in this
fashion? Could it cause accessibility problems on some browsers?

I know it's terribly lazy but I have an awful lot of work to do and not
enough time just yet to learn good PHP skills.


Jun 16 '06 #2
Tristán White schrieb:
Could it cause accessibility problems on some browsers?

I know it's terribly lazy but I have an awful lot of work to do and not
enough time just yet to learn good PHP skills.


Hi

Browsers just get the output of the script - they dont care how it is
generated so if there are any browser-problem they are also in your
HTML-only-code.

Many people separate HTML and PHP-Code because its easier to maintain.
However - its your choice. Visitors will not see a difference

Florian
Jun 16 '06 #3
Message-ID: <C0************ ******@charitie sadvisorytrust. org.uk> from
Tristán White contained the following:
All the webpages are PHP, but contain HTML as a string definition. Which is
actually nice and easy for me as I am an HTML specialist, but am a complete
newbie with PHP.
Cool, an HTML specialist :-)
....

<table width="90%" border="0" cellpadding="5" height="339">
<tr>
<td
width="20%">&n bsp;</td>
<td width="51%">
<p><font
size="7" face="Verdana, Arial, Helvetica, sans-serif"><b>Don\t know if this
is a good idea</b></font> ..........etc


That's so last century...
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jun 16 '06 #4
adlerweb wrote:

Browsers just get the output of the script - they dont care how it is
generated so if there are any browser-problem they are also in your
HTML-only-code.

Many people separate HTML and PHP-Code because its easier to maintain.
However - its your choice. Visitors will not see a difference


It *does* matter. Program code isn't written for computers to understand -
its written for people to understand. This kind of thing makes maintaining
the code very difficult and fraught with errors. You don't need a
templating system to seperate the HTML from the application logic - but
that doesn't mean you SHOULDN'T seperate the two.

C.

Jun 16 '06 #5
Agree with Colin, why bother doing something if you don't do it right.
If your company is anything like mine 3-4 months down the road (just
when you forget what you did) a user will ask for an upgrade and youll
be stuck trying to figure out what you did or why the hell you did it
that way.

Colin McKinnon wrote:
adlerweb wrote:

Browsers just get the output of the script - they dont care how it is
generated so if there are any browser-problem they are also in your
HTML-only-code.

Many people separate HTML and PHP-Code because its easier to maintain.
However - its your choice. Visitors will not see a difference


It *does* matter. Program code isn't written for computers to understand -
its written for people to understand. This kind of thing makes maintaining
the code very difficult and fraught with errors. You don't need a
templating system to seperate the HTML from the application logic - but
that doesn't mean you SHOULDN'T seperate the two.

C.


Jun 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4536
by: Martin Lucas-Smith | last post by:
I am trying to use PHP's COM support to open a URL from within MS Word then save the document. I am using PHP5.0.3/Apache2/WindowsXP. phpinfo() confirms that COM support is enabled. Manually, this would be: - Start MS Word (am using Office 2003)
28
1933
by: petermichaux | last post by:
Hi, On my computer apache will see php in .php documents but not in .html documents. Can I configure apache to see php in .html documents? Or is this something that cannot be done at all? Thanks, Peter
1
2109
by: Jon Noring | last post by:
I am considering a custom URI scheme which identifies various resources, such as id's, within a coherent set of multiple XML documents using the query component. I was told that the syntax I'm considering is not valid per RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt), or some other related spec. I am mystified, but then I am not well-versed in URIs. Here's one example of the syntax being considered:
5
5776
by: Neville310 | last post by:
I have a few questions about the name attributes and href referencing to. Can you declare name attributes for tags other than anchor elements (like div or h2)? The validator keeps returning the following error for HTML 4.0 strict . Line 139, column 12: there is no attribute "NAME" <h2 name="heading">H2 Headline </h2> | You have used the attribute named above in your document, but the document type | you are using does not support...
1
1176
by: Bill H | last post by:
I am a beginner programmer taking my first VB 6.0 class, please forgive me if this question is foolish. Question: How is XML (Extensive Markup Language) a part of the .NET environment and is it intended to replace HTML. Anyone's comments would be appreciated. Please refer to another newsgroup if I am in the wrong place.
2
2456
by: bissatch | last post by:
Hi, I am currently writing a simple PHP program that uses an XML file to output rows for a 'Whats New' page. Once written, I will only require updating the XML file and any pages that use the XML file will get their row content from there. The rows may look some thing similar to this: - Added <a>mailing list</a> functionality to <a>homepage</a> - Competition winners announced, click <a>here</a>
10
2381
by: serge calderara | last post by:
Dear all, I need to build a web application which will contains articles (long or short) I was wondering on what is the correct way to retrive those article on web page. In orther words, when there is such information to be displayed are they coming from imported files, database ? Where and how this type of information is stored ? What is the way to retrieve such information in order to display it in page ?
15
2163
by: dn | last post by:
I'm starting an n-tier application with an ASP.NET 2.0 presentation layer, a business layer, a data access layer, and a SQL Server 2005 database, and I have a question. In the business and data access layers, should I use static methods? Or, should I code the classes so that they have to be instantiated? I've seen examples of both, and I'm not sure which is the "preferred" or "best" way. Thanks.
32
2723
by: Next | last post by:
Hi folks, Years ago, it occurred to me that a lot of the trouble of writing web browsers is caused by the upside-down arrangement of things: Javascript code exists inside a document, when really it should be the other way around. And yet, although this seems fairly obvious to me, having tried myself to write a web browser and given up, I don't see a lot of movement by major web browser projects in a direction that might TRULY fix the...
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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
10364
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
10370
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
10109
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
9186
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...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.