Jump to content

Recommended Posts

I used DreamWeaver to start with, everything was WYSIWYG. Then I decided to look at php, if you want to put php into html you really need to know html to start with. So this caused me to get to grips with taggin and now I'm using Quanta for just about everything. I still go back to Macromedia Studio for the odd bit of flash.

I've only messed about with Frontpage on dhtml and the built in features would love to know more.

Link to comment
Share on other sites

Okay, different subject maybe but what's the advantage in learning javascript? I was just viewing some webpages including paul's who's page is beautifully done and it was easy to comprehend the code and such. Then I viewed another page which is ugly and not dynamic at all and it was programmed in javascript and the coding was a nightmare!

 

<offtopic> I just earned money for designing a couple of basic web pages! Okay, I cheated because I had to do it in windows (the program I was getting the graphics from only runs in windows) so I used Front Page which is what made me decide I wanted to learn html! What an awful program!</offtopic>

Link to comment
Share on other sites

if want stuff to happen without the page reloading (example: mouseover effects, or changing images) then you will need Javascript.

 

Javascript can be very complex, and it can be very simple

I only know the simple stuff

<img id="my_image" src="....

document.images.my_image

for example refers an image on this page called my_image

 

anything beyond that ... I google it ! :-P

 

the beautiful code (thanks for that ;-) ) ... I spend far too much time cleaning my code. Making sure that indents are correct etc etc ....

 

and yes, when you view the source of one of my websites, they are easily read ;-)

 

Johhnyv seems to be a bit of a javascript/DOM geek ! ;-) ... dude ?

altho' I don't recall seeing any of your work johnnyv ?

Link to comment
Share on other sites

Johhnyv seems to be a bit of a javascript/DOM geek ! ;-) ... dude ?

altho' I don't recall seeing any of your work johnnyv ?

 

Oh no! i just learn enought to get by, when i need something like dynamic multiple selects, i just figure it out then write a php function for outputting it, then forget about it.

 

If instead of javascript browsers could understand php i would be sooooo much happier.

 

The reason you don't see my stuff is because it is all in house work, which is great because i then only have to code for mozilla browsers.

 

Heres an example of some code i did recently. a command line script for looking at a specified path and finding all the pdf files in it and it's subdirectories. After finding all the file paths and creating an array i then go through the array and use the external program ps2ascii to create text files with the same name eg) blah.pdf creates blah.txt. If blah.txt is already there i just skip it. This is for the intranet search engine so it can display and search the txt file but link to the actual pdf.

Beware that if you want to use it, that the ps2ascii program can take quite a while to process big files so if you have a lot of pdfs it will take quite a while.

You can also convert postscript files just change all the ".pdf" references to ".ps" etc or use different programs like html2txt etc with a few changes.

 

You run it at the command line: php pdf2txt.php

You would need the standalone php executable installed rather than the apache_module.

Oh and you would of course need ps2ascii installed and it's required programs like Ghost script.

 

pdf2txt.php

<?php

// will use for creating txt files from pdfs for intranet search engine



// root directory path, change to your requirement

$path = '/home/data/';





function map_directories($path)

{

global $counter; // I like counting pdfs yay!

$counter = 0;

$continue = true;

$d = 0;

$f = 0;

$file_array;

if($handle = @opendir($path))

{

 while(false !== ($file = readdir($handle)))

 {

	 if ($file != "." && $file != "..")

	 {

   if(!eregi("index", $file))

   {

   $type = filetype("$path$file");

  	 if($type == "dir")

  	 {

  	 $directory_array[$d] = $path.$file."/";

  	 $d++;

  	 }

  	 if($type == "file")

  	 {

     if(eregi(".pdf",$file))

     {

     $file_array[$f] = $path.$file;

     $f++;

     }

  	 }

   }

	 }

 }

}

closedir($handle);

while($continue)

{

 if(isset($directory_array))

 {

 $temp_array = $directory_array;

 unset($directory_array);

 $d = 0;

	 foreach($temp_array as $path)

	 {

   if($handle = @opendir($path))

   {

  	 while(false !== ($file = readdir($handle)))

  	 {

     if($file != "." && $file != "..")

     {

    	 if(!eregi("index", $file))

    	 {

    	 $type = filetype("$path$file");

       if($type == "dir")

       {

       $directory_array[$d] = $path.$file."/";

       $d++;

       }

       if($type == "file")

       {

      	 if(eregi(".pdf",$file))

      	 {

      	 $file_array[$f] = $path.$file;

      	 $f++;

      	 }

       }

    	 }

     }

  	 }

   closedir($handle);

   }

	 }

 }

 else

 {

 $continue = false;

 }

}

$counter = $f;

return $file_array;

}

// only second resolution time but the directories are so big it doesn't matter

$start_time_files = time();



$file_array = map_directories($path);



$finish_time_files = time();



$display_time = $finish_time_files - $start_time_files;

// display the results

echo $display_time." seconds to find $counter pdf files, beginning txt processingn";



if($file_array)// ok found some pdf files

{

$start_time_files = time();

$i = 0;

$pdf_counter = 0;

while($i < $counter)

{

$path = $file_array[$i];

$txt_path = eregi_replace(".pdf",".txt",$path); // had to use a case insensitive string replace

 if(!is_file($txt_path))

 {

 // no txt file exists for this pdf create it.

 // oh crap with over 4000 pdf files the first run is going to take a long time!

 $command = shell_exec("/usr/bin/ps2ascii $path $txt_path 2>&1");

 echo $command;

	 if($command != "")// if we got an error display the file path

	 {

	 echo $path."n";

	 }

 $pdf_counter++;

 }

$i++;

}

$finish_time_files = time();

$display_time = $finish_time_files - $start_time_files;

echo $display_time." seconds to process pdfsn";

echo $pdf_counter." pdf files converted to txtn";

}

else

{

echo "File array could not be generated from path: $path";

}



?>

Link to comment
Share on other sites

Javascript is good for simple things. Like mouseovers and the like. If used well it can make a difference to the page. I used javascript to make navigation for a webpage. I had 1 external js file that was used for every page. One change there changed the whole thing. Made things a lot easier.

Also server side stuff is generally browser independant. Which is good.

James

Link to comment
Share on other sites

mystified: javascript should be one of the LAST things you learn. Unless you already know some kind of C like programming.

 

If you take a look at my page in my sig, which I've been adding a lot to recently, I coded that in html all by hand. I used dreamweaver to get the mouse over effect for 2 of the pictures (and the butons on the left), but that's it. Only because I don't know javascript yet, though. When I do, I'll redo it by hand.

 

When I was about 12, I taught myself html by viewing the source of other webpages "Oh! OK, if I want bold, I just <b>BOLD_TEXT</b>" (I took to BBCode in about 5 minutes after that! ;) )

 

If you want, check out my page - I like sharing code ;) - it's not too big, and includes frames, bold, italics, blinking text, font sizes and colours, pictures, links, etc... All the basics. Start easy!! I already know html, C, C++, pascal, basic, assembly, and more - and I haven't learned perl, php, java or javascript YET, but I plan to! But as per my page, you can get a lot of nifty things using simply the basics.

Link to comment
Share on other sites

Please note: Site requires Internet Explorer 5.5 or 6

 

I am surprised at that!

:P

 

:oops::oops::oops::oops:

I've been embaressed to show it to anyone for a while. But i thought it might help here. All the XML in it requires IE, i haven't made it compatible with Mozilla (and it doesn't work properly in IE). I haven't touched it since late last year. I've most likely abandoned it now. THe site uses client-side for everything except the Forums. i can use something called Sarissa to make it Moz friendly, but as i said, i've pretty much abandoned it now. It was made before i started with Linux.

 

James

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...