Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-12-2011, 06:56 PM embeded HTML
madnhain's Avatar
Experienced Talker

Posts: 42
Name: Jez
Location: Grand Junction, CO / Williston, ND
Trades: 0
Is there a slick way of embedding HTML that doesn't involve constantly opening and closing the php tags or escaping quotes? It seems I always run into issues when embedding html, particularly when I'm trying to use a php variable inside the html.
madnhain is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-12-2011, 07:03 PM Re: embeded HTML
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
You could use the heredoc syntax:
http://www.php.net/manual/en/languag...syntax.heredoc

Personally I don't really have a problem with opening and closing tags. Maybe it's just a matter of taste. Can you give an example of where it is a problem for you?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-12-2011, 07:37 PM Re: embeded HTML
madnhain's Avatar
Experienced Talker

Posts: 42
Name: Jez
Location: Grand Junction, CO / Williston, ND
Trades: 0
well, not really having problems, I just find it tedious and annoying.

I prefer opening and closing the php tags, though in order to use a php variable it has to be echo and escaped. (so far as I know)

I've got a MASSIVE table with over 400 input fields, and in order to put the date, and other various auto-fills in some places using a variable, I now have to echo and escape close to 1500 lines of code.

Terribly annoying.
madnhain is offline
Reply With Quote
View Public Profile
 
Old 03-12-2011, 08:11 PM Re: embeded HTML
Super Spam Talker

Posts: 880
Name: Paul W
Trades: 0
Quote:
Originally Posted by madnhain View Post
well, not really having problems, I just find it tedious and annoying.

I prefer opening and closing the php tags, though in order to use a php variable it has to be echo and escaped. (so far as I know)

I've got a MASSIVE table with over 400 input fields, and in order to put the date, and other various auto-fills in some places using a variable, I now have to echo and escape close to 1500 lines of code.

Terribly annoying.
Or you could just do it in a function or two, given they're essentially the same lines repeated.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 03-12-2011, 08:32 PM Re: embeded HTML
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Maybe if you provide some more details someone can come up with a less tedious solution. As Paul pointed out you can use a function to generate the input fields. For example:
PHP Code:
<?php
function text_field($key$value null)
{
    if(
$value === null && isset($_POST[$key]))
        
$value $_POST[$key];
?>
<input type="text" name="<?php echo $key?>" value="<?php echo $value?>" />
<?php
}
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-12-2011, 10:11 PM Re: embeded HTML
madnhain's Avatar
Experienced Talker

Posts: 42
Name: Jez
Location: Grand Junction, CO / Williston, ND
Trades: 0
here's a link the the form in question: http://testarea.net78.net/crown/time_sheet.php

it's a constant work in process, and doesn't have any style yet. Basically, it's a time sheet that will be filled out, the input field for CREW will actually end up being a drop down menu dynamically filled by a list of available crews which will be edited by staff. (I could probably implement the function call there)

on the top of each "day" on the right, it says "A_date" that will be auto-filled with the appropriate date for that particular day of the week.

I tried doing something like this:
PHP Code:
<input type="text" name="i_week_ending" size="24" value="<?php include('mylibrary/fridays_date.php'); ?>"/>
but it's not producing the results I want yet...

<edit>

after the employees fill out their time sheets, the staff will need to be able to alter this information, so they will need to view this form with all the contents that the employee provided. each form field will need to have a value=$*** that will be pulled from the database. I think that's going to be the bugger.

Last edited by madnhain; 03-12-2011 at 10:58 PM..
madnhain is offline
Reply With Quote
View Public Profile
 
Old 03-13-2011, 11:09 AM Re: embeded HTML
Super Spam Talker

Posts: 880
Name: Paul W
Trades: 0
You need a major step back and a bit of study on software design! You're undertaking a significant development without the necessary knowledge - you're going to spend an age developing spaghetti code that might work one day if you're lucky!

Take a big step back. Read a little about the s/w design process, read up on functional decomposition - get an idea of program structures, then get an idea of the language features, then plan the code. Old, old saying: The sooner you start writing code the longer it takes.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 03-13-2011, 12:41 PM Re: embeded HTML
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
And I agree 100% on what Paul is saying.

One day of planning the code will save a week of debugging. It may seem tedious intially but it will payoff later.

Also try to work in functions, modules or classes. Each one can be tested as you complete them and it provides a structure to the overall development process.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-17-2011, 12:49 PM Re: embeded HTML
madnhain's Avatar
Experienced Talker

Posts: 42
Name: Jez
Location: Grand Junction, CO / Williston, ND
Trades: 0
thanks for the input guys!
madnhain is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to embeded HTML
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29003 seconds with 12 queries