okparrothead 1 Light Poster

Hi Essaral,

Figured it out.

EOL tag was wrong so the script wasn't reading the correct data.

Thanks for everything,!!!

okparrothead 1 Light Poster

Hi Ezzaral,

After further testing, I'm still getting errors so I'll keep after it.

Peace

okparrothead 1 Light Poster

Thanks Ezzaral. You're the best.

You were right on the money.
Some of my amounts could be longer than two digits though, so I came up with this:

$item = file((session_id()."-".($_SESSION ['company']).".txt"));
        foreach($item as $key => $val){
            $data[$key] = explode(",", $val);            
                }
                for($k = 0; $k < count($item); $k++){                          
            $subtotal[$k] = ereg_replace("[^0-9]","",$data[$k][4]);}
    echo (array_sum($subtotal));

What do you think?

Thanks so much for teaching me how to create an array this way. This has really helped me out a lot!!

Peace

okparrothead 1 Light Poster

Thanks Weber!
Hi Ezzaral,

Thanks for all your help.
I'm still being dense.
You can see the file contents earlier in the post.
Here's the code I have so far.
Could you tell me where I'm going wrong?

$item = file('order.txt');
        foreach($item as $key => $val){
            $data[$key] = explode(",", $val);
        }
        for($k = 0; $k < count($item); $k++){
            $subtotal[$k] = $data[$k][4];
        }
        echo (array_sum($subtotal[$k]));

I keep getting errors saying:

[B]Notice[/B]:  Undefined offset:  1
[B]Warning[/B]:  array_sum() [ function.array-sum ]: The argument should be an array

Thanks for any clues you can give me.

okparrothead 1 Light Poster

Thanks Weber,

No joy yet, but I'll keep after it!

Peace

okparrothead 1 Light Poster

Thanks for your quick response Weber,

Is there a way to only print the last item on each line?

Even better, put them in an array?

I'm familiar with array_sum as a command, but I don't know how to get all the subtotals (the last item in each row) into an array.

Thanks!!

okparrothead 1 Light Poster

hello DaniWeb Forum,

I need help with reading a csv.

Here's the file:

product name, color, width, quantity, subtotal
product1, red, 20", 200, $30
proudct2, blue, 30", 10, $12

I've written code that creates this file as an order.

What I'd like to do is read the subtotals and generate a grand total.

So I need to read all of the $data[$k][4] and generate a sum.

Any help would be greatly appreciated.

Peace

okparrothead 1 Light Poster

Thanks Smalldog,
I see what you're getting at.

I already have a print style sheet. Will this effect how the present style sheet works?

okparrothead 1 Light Poster

Hello DaniWeb Experts

I haven't found this topic in the forums, so if its been covered, please redirect me. Thanks

I have a page which has a div with product instructions at the bottom.

Is there a way to create a print button that will cause only the instruction sheet to print, not the whole page, with the style I want?

I could just set the print style for this page to print the instruction sheet only, but I don't necessarily want to disable printing the whole page.

Am I asking in the right forum?

Thanks for any help you can give me.

okparrothead 1 Light Poster

Thanks RG,

Yes, it seems counter intuitive to assign inline attributes to a block item.

What I'm trying to achieve is divs in rows where the width of the container and the number of divs in a row are unknown.

I have a fluid width page design, and floating the blocks left made them line up in rows, but when the width was more than 3, but less than 4 in a row the divs all floated left, and there was too much air to the right.

The technique described by Rhyan brought them to the center of the page though without captions -- success! (of a sort)

I've almost got the page completed and will post the results here when I do.

okparrothead 1 Light Poster

Hi all,

I didn't abandon my post, I just got sidetracked. Thanks for hanging in there with me.

Rhyan, your suggestion worked! Unfortunately I had to ditch the image cations. Whenever I added anything more than the img itself, I got a vertical column 1 image wide. It was centered, but only one column.

Thanks for everything!

okparrothead 1 Light Poster

Thanks Rhyan,
After reading your link I understand caption better. I was using it for a photo caption.

Yet another newbie mistake! Doh!

Thanks for everything!

okparrothead 1 Light Poster

Thank You Rhyan,

Your help is much appreciated.

I think (Hmmm. Maybe.) I see how this will work. By going inline with the divs, they don't have to float left. By wrapping them in a div that is auto centered, they bounce to the center.
I'll give this a whirl and see what happens.

As for using <caption>, I was identifying the text as a caption for search engines, as opposed to a heading or a paragraph. Is this not needed?

Thanks again!

okparrothead 1 Light Poster

Hi Rhyan,
Sorry I didn't explain myself very well.

Actually, what I have is this:

<div>
<img>
<caption>
</div>

<div>
<img>
<caption>
</div>

etc.

etc.

with the divs defined as the same height and width, floated left so they'll sit in rows.

My page is liquid in width, with defined columns at left and right, so the part that's liquid is the center column.

When the viewport is 1024px wide, there could be three or four thumbs across, depending on the size of the thumbs.

If the viewport is 800px wide, the row could be maybe two or three thumbs across. If it's something narrower or wider, there will be as many as will fit.

What I want to achieve is the centering of the thumbs if the width of the viewport leaves enough room for more than 2 but less than 3, or more than 3, but less than 4, etc.

Right now, everyting works great, but when there's extra width, there's too much air on the right.

I don't think it can be done with CSS, but I thought I would ask.

That is, unless you can think of something...

Thanks for all your help in any case!

okparrothead 1 Light Poster

Hello CSS Experts,

As far as I can tell, what I want to do can't be done.

Ihave a gallery page that is liquid in width.

Instead of liquid widths of thumbnails, when the page is narrow, I'm planning on two columns (or one) of images, but when the page is wide, three columns (or four).

The thumbs are in divs that are floated left to get them to sit in rows.

So far everything works as planned.

Now, is there any way to center the floated images in the page?

In other words, if the page is wide enough for 3 1/2 thumbnails, is there a way to put them in the center of the page rather than floated all the way left?

I considered an additional div to capture all the thumbs and center it, but then it would have to have a defined width which sometimes may be too wide.

Thanks for ayn help you can give me!

okparrothead 1 Light Poster

Hello Roryt, Forum Members,
To minimize the differences of all elements in different browsers, you can add:
* {padding: 0px; margin: 0px} to your style sheet. This eliminates the default margins and padding for everything. Elements like for H1, h2..., <li> <input>, etc. have different styles in different browsers. This starts you off with a level playing field. You'll have to go back and add some margins and padding to elements you didn't have to style before however!

Peace

okparrothead 1 Light Poster

Have you tried to FTP directly to your domain name?

I host on a shared virtual host (Linux) and until the DNS servers knew where my domain was, I had to use the server address e.g. server2.somesite.com/~myuser. However -- once the name servers knew where my domain was, as is the case with your domain, I was able to use an FTP client to access the files directly at my domain name.

I don't know the configurations for Dreamweaver, but have you tried accessing your site using a stand alone FTP client to see if you have access? It would seem your original PW ID combo would work if the site is still on the original server.

okparrothead 1 Light Poster

For text editing I use TextPad, and for WYSIWYG coding I used to use Net Objects Fusion but I don't anymore. For the record, I haven't used Dreamweaver or GoLive and probably won't. I seem to run up against the limitations of WYSIWYG editors too soon. They also generate some bulky code.

okparrothead 1 Light Poster

digital-ether,

I've tried to create a script like this on more than one occasion, but no joy. Your instructions have finally gotten through my clumsy mind.

Thank you SO much.

Peace

okparrothead 1 Light Poster

Hello gang,
Here I am with another Newbie question.

I'm creating a photo gallery for my Web site.

Right now I use a series of links to create the gallery:

<a href="./images/gallery/photo1.php"><img src="./images/gallery/thumbs/tn_photo1.php"></a>
<a href="./images/gallery/photo2.php"><img src="./images/gallery/thumbs/tn_photo2.php"></a>
<a href="./images/gallery/photo3.php"><img src="./images/gallery/thumbs/tn_photo3.php"></a>

My Linux host will already make the thumbnails from images I upload, and I've styled the links so they appear the way I want them to and it works fine.

I would like to be able to generate these links using a php script instead of having to make the above by hand. I'd like it to read the filenames in the gallery folder and create the links.

I looked at the oepndir command, but I don't know how I can make it create a link. I'm just plain confused.

Thanks for anyhelp you can give me.

Peace

okparrothead 1 Light Poster

You really think so?
I thought it was pretty well par for the course.

Hmmm. Maybe I'm trying too hard.

okparrothead 1 Light Poster

What I test in:

I test in IE 5.5, 6 and 7, Opeara 6.2 and 7 and Netscape 6.2 and 7 and I recently upgraded to FireFox 2. I also view the sites in Lynx. As a last test I also see how the sites look in Konqueror on Linux. I have no Apple testing capabilities. I test for both XHTML and CSS code validation.

How I do it:

I use standalone versions of IE 5.5 and 6 that I got from Evolt.org and I installed the different versions of Netscape in different directories so I could use them all without conflicts. I use a plug-in in Firefox that lets me view the pages in Lynx. I also use the plug-in cscgal mentioned earlier in the post. I boot from a Koppix CD and view the sites in FireFox and Konqueror to see how they look there. I validate the XHTML and CSS at W3.org

What I test for:

I test for full compatibility in IE 6 and 7, Opera 7 and Netscape 7.

I test for graceful degradation in IE 5.5, Opera 6 and Netscape 6.2 ie parts work, but don't neccssarily look the same.

I test in Lynx because some handheld devices don't honor style sheets so how the text looks is still important.

Questions I have:

From what I understand, Konqueror uses the same codebase as Apple Safari and should render the same. Does …

okparrothead 1 Light Poster

Hello All,

Thanks for all of your help.

I couldn't get any of your suggestions to work. Just zoomed over my head I suppose. As Homer would say -- Doh!

Anyway, I did find a solution. :p

In my page template (page.php), along with other divs, I have code that looks like this that make up my web pages:

<div id="content">
        <?php       
            echo $content;          
       ?>
</div>

On another page (about.php for example) I would define a set of variables, one of them being $content, that contained html code to be placed in the assorted divs on the page. At the end of that page, I would "include" page.php.

The $strings would echo in and all would be well except I couldn't put an include in a string and have it process.

So my solution was this:

<div id="content">
        <?php
            if (file_exists($contentfile)) {
            include ($contentfile);
            }
            else {
            echo $content;
            };
       ?>
</div>

I now define both $content and $contentfile in about.php.
If there needs to be an include, I name $contentfile as the path to that file. If I don't need an include, I use $content to put html code into that div.

I know, I know, I'm reinventing the wheel. But hey, I'll get there someday.

Thanks again for all of your help.

It was through trying to get your suggestions to work that I came up with this solution. I wouldn't have gotten there without your help.

okparrothead 1 Light Poster

I see what you mean, FC.

I used this technique but had a link in the top level so even without the drop down, it would work.

It does work in IE 7 though, but the CSS will have to be tweaked.

Seems like a lot of folks will turn off javascript as a security measure, so I was doing without.

Thanks for the heads up.

Peace.

okparrothead 1 Light Poster

Thanks for all the help!!

I guess I wasn't too clear with my first explanation, but you probably still answered my question.

I have a php page with $variables for all the content on the page except the menu, header and footer, they're in seperate files.

At the bottom of the page, I include a template that contains echo commands for the strings and include commands for the three other files. It puts the content where I want it in the page. Works great.

Sometimes, however, I want to include a file in the middle of the content, a photo gallery for example, or a googlemap script. Using echo won't let the script run.

I'll try the techniques you taught me and post the answer here when I find out which works.

Thanks again,
You're the best!

Peace

okparrothead 1 Light Poster

FC,

Sweet! You even made it work in Internet Explorer.

Kudos.

okparrothead 1 Light Poster

Hello all,

I have a newbie question.

I need an alternative to this:

$variable = 'Sometext with some other text <?php include 'somescript.php'?> some more text';

where $variable will be echoed into a webpage as part of the page content.

I can echo text into the page all day, but not an include.

I'm guessing that the echo command doesn't process the variable, but I don't know what command to use to process the include on the way to, or after its in, the page.

Would it be fwrite? If so, how can I get it to write to the file the $variable is in?

Thanks for all your help.

okparrothead 1 Light Poster

Hello all.

cath120,

Here's an alternative that might work for you.

http://www.serve.com/apg/workshop/cssMenu.html

It uses nested unordered lists of links and css styles to "hide" the drop down links until mouseover.

I hope this helps.

Peace

FC Jamison commented: It's got to work in all browsers, my friend +0
Mike555 commented: -mike555 +1
okparrothead 1 Light Poster

Hi Uncle Scruffy,

Broken Arrow is East of Tulsa and once was a seperate community. In a few more years it'll just be a suburb (very soon) of Tulsa.

I've been to Enid. The thing I remember is the gigantic grain silo. I've never been to Ames. Where is that in relation to Tulsa?

Hi, Kevan.

Noticed you live in Broken Aroow, OK. Was born in Enid, OK, and lived in a spot on the map called Ames, OK. Closest medium town to Ames is Drummond, OK.

Where is Broken Arrow in relation to these towns?

Uncle Scruffy

okparrothead 1 Light Poster

Hello Friends,

I came to DaniWeb for solutions to problems I was having with Windows Media Player. By trying things I read here, I found these solutions so I thought I'd share them with you all.

First, my rig:

VIA KT4V Motherboard with onboard video and audio
AMD Athlon 2400+
S3 Virge display adapter
Realtek AC'97 Audio controller
Windows XP Pro SP2
Windows Media Player 10

I installed WMP 10 to fix my primary problem, but it didn't work so I suspect these options got misconfigured under WMP9.

Problems:

My primary problem was that a .wmf video clip wouldn't show in WMP. I could hear the audio, but only got a dark green screen for the video. If I opened it to full screen mode (terrible resolution), it would show. But then, when I reduced the size of the view, I only got the top left corner of the video -- at the full screen video resolution!

I uninstalled/reinstalled WMP and lost the audio as well, so when I ran WMP I could open to full screen and see the video, then resize and see the top corner, but now it didn't play the sound.

Video Solutions:
In WMP, go to Tools>Options>Performance>Advanced

Digital Video set at Large

Under "Video Acceleration" uncheck "Use video mixing renderer" leaving all other selections checked.

I don't use DVD's, but I suspect the same for "DVD Video"

okparrothead 1 Light Poster

Thanks for the warm welcome Dani! This is my first membership in an Online community, but I've got a good feeling about it already :)

Name: Kevan

Nickname: Papu (My twin Grandsons!!)

Height: 5'11"

Weight: 180 ?

Location: Broken Arrow, OK

Age: Too young for Medicare, too old for women to care

Relationship: Married to the most wonderful woman on the planet. Eat your hearts out!

Music: Jimmy Buffet (Parrothead), James Taylor, Stevie Wonder, Santana, Jackson Brown, CCR, Sam Cook, Four Tops, '70's Rock, Jazz, Classical, Latin

Education: Some College, Writer's Classes

Work: Freelance Web Development (PHP, XHTML, CSS), Fiction and Non-Fiction Writer, Cabinet Maker

Few Movies -- Little TV -- No IM

Hobbies: Spending time with my Grandchildren, Reading (online, books -- Fiction, Non-fiction), Sharing food and wine with friends, Cooking, Jimmy Buffet music, learning something new.

Dislikes: Judgemental people, Pompus Jerks, People driving slow talking on cell phones.