
sdowney1
Members-
Posts
44 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
sdowney1's Achievements

Member (2/5)
0
Reputation
-
I configured the router to forward 80, and 8080 I set Apache to be listening on 80, and 8080 I can view my php pages on localhost. But when I go to my wan IP, I dont get anything. Should I be able to or not? Is that only available for those coming in from the outside? http://www.canyouseeme.org/ This can see me on port 8080
-
fixed with these, either one will work by help from http://ubuntuforums.org/showthread.php?p=10528481#post10528481 // echo " <td WIDTH='350' VALIGN='top' align='right'>$mdata[$loop600]</td>"; //the names of the numbered fields // echo " <td WIDTH='600' VALIGN='top' align='left'>$arr[2]</td>"; //the first data of the subfield of the tag echo " <td style='width:350px;vertical-align:top;text-align:right;'>$mdata[$loop600]</td>"; //the names of the numbered fields echo " <td style='width:600px;vertical-align:top;text-align:left;'>$arr[2]</td>"; //the first data of the subfield of the tag
-
vertical-align='top' ignored in table vertical-align:top is also ignored it does respond to width and also does respond to align I put some data in a table with 2 columns when ever the second column overruns the width so the text wraps, the first column text centers in the table cell. I want it to pin itself to the top of the cell. this is it here. //print array here, split off chr(29) echo "<table width='952' border='0'>"; //$mdata holds the tag names with each number corresponding to the text name $loop600 = 1; while ($loop600 < 900)//dont show local LOC tags { if (!empty($taggs[$loop600])) { $arr = explode(chr(29),$taggs[$loop600]); //if ($loop600 == 650) {print_r ($arr);} echo " <tr>"; echo " <td WIDTH='350';vertical-align='top'; align='right'>$mdata[$loop600]</td>"; //the names of the numbered fields echo " <td WIDTH='600';vertical-align='top'; align='left'>$arr[2]</td>"; //the first data of the subfield of the tag echo " </tr>"; for ($i = 3; $i < count($arr); $i += 2) { echo " <tr>"; echo " <td>"." "."</td>"; echo " <td>".$arr[($i+1)] ."</td>"; echo " </tr>"; } $arr = array(); } $loop600 = ($loop600 +1); }
-
move input box at the end of a previous echo line?
sdowney1 replied to sdowney1's topic in PHP Coding Help
thanks, that was easy I know CSS is a good way to do things. I am pretty new at this echo '<FORM NAME="z3950search" ACTION="z3950get.php" METHOD="POST">'; echo $page_pagination; echo ' Or go to page number '; echo '<input type="text"SIZE="5" name="pageinput2" value="'. $page_num.'">'; echo '<input type="hidden" name="recordcount" value="'.$recordcount.'"/>'; echo '<button type="submit" name="pageinput1" value="search">Get page number</button>'; echo '</FORM>'; echo '<BR><BR>'; echo 'Showing Page Number -> '.$page_num. ' | Total number of results -> '.$numrows . ' | Total number of pages -> '.$numofpages.'<BR><BR>'; -
How can i simply put the input box at the end of echo $page_pagination; instead of dropping down to a new line. echo $page_pagination; echo '<FORM NAME="Library Search" ACTION="z3950get.php" METHOD="POST">'; echo '     Or go to page number '; echo '<input type="text"SIZE="5" name="pageinput2" value="'. $page_num.'">'; echo '<input type="hidden" name="recordcount" value="'.$recordcount.'"/>'; echo '<button type="submit" name="pageinput1" value="search">Search</button>'; echo '</FORM>'; echo '<BR><BR>'; echo 'Showing Page Number -> '.$page_num. ' | Total number of results -> '.$numrows . ' | Total number of pages -> '.$numofpages.'<BR><BR>';
-
this is working much better with cURL, it has to be on, installed to work. XML file retrieved very quickly now. for ubuntu sudo apt-get install php5-curl sudo /etc/init.d/apache2 restart //http://ar2.php.net/manual/es/function.file-get-contents.php#82255 $url = curl_get_file_contents($request); function curl_get_file_contents($URL) { $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $URL); $contents = curl_exec($c); curl_close($c); if ($contents) return $contents; else return FALSE; } $filename = dirname(__FILE__)."/loc.xml"; //echo $raw_xml; $fp = fopen($filename, "w"); fwrite($fp, $url); fclose ($fp);
-
I am trying to retrieve an xml file from a webservice. I cant use the original server since it gags on non latin characters, unicode?, that is what the LOC says. The other server does work with non latin characters BUT it is too slow with file_get_contents, takes a minute to get anything, so slow you cant even use it in the program. YET, retrieves the xml fast in the browser window. So, what can I do that will work fast like it should? //original database server, file_get_contents is faster, about 3 to 10 seconds //$request= 'http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve'.$query.$test2.'&startRecord='.$offset.'&maximumRecords=20'; //new one that can handle non latin characters //file_get_contents is SLOW, so slow to be unusable, about a minute or more $request='http://lx2.loc.gov:210/LCDB?version=1.1&operation=searchRetrieve'.$query.$test2.'&startRecord='.$offset.'&maximumRecords=20'; $raw_xml = file_get_contents($request); $filename = dirname(__FILE__)."/loc.xml"; $fp = fopen($filename, "w"); fwrite($fp, $raw_xml); fclose ($fp);
-
you could insert the values of an array as strings separated by a chr(29) then when getting them back split them back out as an array using explode around the chr(29)
-
looking for an algorithm for number progression is now working but
sdowney1 replied to sdowney1's topic in PHP Coding Help
got it with some help on ubuntuforums $dum = (($rpos-1)/20) ; $dum = (int)($dum); $dum = (($dum *20) +1); -
looking for an algorithm for number progression is now working but
sdowney1 replied to sdowney1's topic in PHP Coding Help
Thanks for the help On one page, I display a series of records in 20 record blocks, with pagination. Basically, every next, previous, etc... shows another 20 record set. I create a link displayed with each record based on the record number which is part of each record. Click that it loads another page which displays just that one record. On that page I move forward or back one record at a time. SO, when I post back to the first page that displays the 20 record set, I needed to figure out which set of 20 records to display. I modified what the algorithm needs to this I need to take in a number from 1 -> 20 and return 1 21 -> 40 and return 21 41 -> 60 and return 41 61 -> 80 and return 61 etc.... so if your displaying record number 15, it posts back to block of records starting at 1 running to 20 so if your displaying record number 25, it posts back to block of records starting at 21 running to 40 -
looking for an algorithm for number progression
sdowney1 replied to sdowney1's topic in Applications
this works, but I quess I posted in the wrong forum I can increment every 20, and there will never be more than 10,000 record count $count = 1; while ($count <= 10000) { if (($rpos>=$count) and ($rpos<($count+20))){$dum = $count;break;} $count =($count +20); } echo 'weirdcounter'.$dum.'<BR>'; -
looking for an algorithm I need to take in a number from 1 -> 20 and return 1 21 -> 40 and return 2 41 -> 60 and return 3 61 -> 80 and return 4 etc.... yes, it also involves PHP On one page, I display a series of records in 20 record blocks. basically, every next shows another 20 record set. I have a link for each record based on the record number. Click that it loads another page which displays just that one record On that page I move forward of back one record at a time. SO, when I post back to the first page that displays the 20 record set, I need to figure out which set of 20 records to display.
-
I got ! backwards, sorry! why I had to change this to which seems backwards to me. anyhow, thanks for the help so far.
-
finally got some help here as I was truly stuck on the child node processing http://ubuntuforums.org/showthread.php?t=1693277 This following code takes an xml marc file and parses it out to match what LOC normally displays as a marc record It uses DOM but since it wont have more than 20 records it should be ok. It shows how to display the attributes associated with child element EXCEPT, I dont understand why I had to change this to as I thought subfield was a child node of datafield?? any ideas? <?php //http://www.phpbuilder.com/columns/DOM-XML-extension/Octavia_Anghel102710.php3 //child nodes http://www.w3schools.com/php/php_xml_dom.asp //http://books.google.com/books?id=ygQRKDEsLecC&pg=PA196&lpg=PA196&dq=print+php+xml+child+node+attributes&source=bl&ots=TCAhH4kpCt&sig=yJUPXesIkRUrNXdNE9Yr5ul7Wdw&hl=en&ei=U51kTeKQKsL48AbN4MDTBg&sa=X&oi=book_result&ct=result&resnum=10&ved=0CF4Q6AEwCQ#v=onepage&q=print%20php%20xml%20child%20node%20attributes&f=false //http://stackoverflow.com/questions/4598409/printing-content-of-a-xml-file-using-xml-dom //http://www.php.net/manual/en/book.dom.php $doc = new DOMDocument(); $doc->preserveWhiteSpace = FALSE; $doc->load( 'loc.xml' ); $root = $doc->documentElement; $type = $root->nodeType; //print $doc->nodeName."\n"; //print $root->nodeName."\n"; //print $doc->nodeValue."\n"; //print $root->nodeValue."\n"; $librecords = $doc->getElementsByTagName( "record" ); foreach( $librecords as $record ){ $leader = $record->getElementsByTagName( "leader" ); $controlfields = $record->getElementsByTagName( "controlfield" ); $datafields = $record->getElementsByTagName( "datafield" ); $leader = $leader->item(0)->nodeValue; echo '=LDR '.$leader.'<BR>'; foreach( $controlfields as $controlfield ){ $tag = $controlfield->getAttribute('tag'); $cf_value = $controlfield->firstChild->nodeValue; echo "=".$tag." ".$cf_value.'<BR>'; } // loop over each datafield foreach($datafields as $d){ $tag = $d->getAttribute('tag'); $ind1 = $d->getAttribute('ind1'); $ind2 = $d->getAttribute('ind2'); $ind1 = ($ind1 == " ") ? "_" : $ind1; $ind2 = ($ind2 == " ") ? "_" : $ind2; echo "=".$tag." ".$ind1.$ind2; // excuse the \n, using CLI if(!$d->hasChildNodes) { // select its subfields $subfields = $d->getElementsByTagName('subfield'); // loop over them foreach($subfields as $s){ $code = $s->getAttribute('code'); $value = $s->nodeValue; print '$'.$code; print $value; } } echo '<BR>'; } echo '<BR>'; echo '<BR>'; } ?> foreach( $subfields as $subfield ){ $code = $subfield->getAttribute('code'); $sf_value = $subfield->firstChild->nodeValue; echo '$'.$code.$sf_value.'<BR>'; }