473,463 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

layout function

Hi there,

i want to build a function to create layout parts.
It has to create tables.

What i want now is to have the following function:
function doTable($state, $width, $height);
{
echo ($state === 1)? '<table width="'.$width.'"
height="'.$height.'"><tr><td>' : '</td></tr></table>'

};
(extremely simlified)

And call it this way:

doTable(1, 350, 400);

echo 'table content';

doTable(0);

Can/How do i handle the 'missing variables' in the second 'doTable()'?

Thanks in advance!

Greetings Frizzle.

Oct 2 '05 #1
6 1278
frizzle wrote:
Can/How do i handle the 'missing variables' in the second 'doTable()'?


function doTable($state, $width = 0, $height = 0)
JW

Oct 2 '05 #2
If i'm not mistaking, do i implement
the following in the function:

echo ($width != 0)? 'width is set' : 'width isn't set';

Greetings Frizzle.

Oct 2 '05 #3
frizzle wrote:
If i'm not mistaking, do i implement
the following in the function:

echo ($width != 0)? 'width is set' : 'width isn't set';


Yep. Alternatively, you can just make the $state argument leading; when it's
0 close the table, ignoring the $width and $height arguments and open a new
table otherwise.
JW

Oct 2 '05 #4
what do you mean with making the $state argument leading?
Indeed, it's meant to close the table when $state === 0, but i
don't quite understand your last answer.
Thanks for helping by the way!!!!!

Greetings Frizzle.

Oct 2 '05 #5
frizzle wrote:
i want to build a function to create layout parts.
It has to create tables.


How about looking at HTML_Table from PEAR? It will generate tables
for you, and you can pass arguments for height, etc. Its a life saver
after you try to modify your table layout later.

/Marcin
Oct 3 '05 #6
frizzle wrote:
what do you mean with making the $state argument leading?
Indeed, it's meant to close the table when $state === 0, but i
don't quite understand your last answer.
Thanks for helping by the way!!!!!


function whatever($state, $w = 0, $h = 0) {
if ($state == 0) {
// Close and full stop, don't care about
// the values of $w & $h
} else {
// Do something with $w & $h
}
}
JW

Oct 3 '05 #7

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

Similar topics

0
by: Merlin_1102 | last post by:
I have read previous posts on the gridbaglayout and none seem to answer my questions (sorry if any of these have been aske dI really did search and found one large thread which took me an hour to...
20
by: Tammy | last post by:
What would be a good alternative to using frames? I need something that will section my webpage into two halves and can change both frames on a single click. Thanks in Advance, Tammy
8
by: G Patel | last post by:
Can people please comment on the layout/style of my problem? The major issue I had was the layout. I ended up having to put a relatively large switch statement, inside an if statement, which is...
6
by: lovecreatesbeauty | last post by:
Hello experts, 1. Does C guarantee the data layout of the memory allocated by malloc function on the heap. I mean, for example, if I allocate a array of 100 elements of structure, can I always...
10
by: Luke | last post by:
Hi. I am trying to make correct layout, here is an example of (dynamically generated content via jsp): http://localhost/www/layout.htm Most outer div is positioned absolute (if not then it...
11
by: rfox | last post by:
I've built a site using tables for layout, and it looks ok in everything but in IE where it places extra space around the graphics that contain a rollover script. (Please see...
10
by: ellie2905 | last post by:
Hello, I am new to this forum and I am glad I found it because it seems that it will help me with my problem.I have creates a site using jsf components like grid panels and buttons.In the mozilla...
10
by: sumsin | last post by:
The C++ Object Model book says that 'Nonstatic data members are allocated directly within each class object. Static data members are stored outside the individual class object. Static and...
11
by: Daniel Norden | last post by:
Hello. Can you give me some feedback on my code layout? I have everything organized in an object, "NRL", that's used as a namespace, and there are other subobjects/modules below that, for...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
1
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...
0
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...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.