richrock
-
Posts
213 -
Joined
-
Last visited
Posts posted by richrock
-
-
You are a genius - I'll have to make a note of this. We had a run of clients who bought .co domains and now regret it for some reason.... Thanks
-
Right, I'm fairly comfortable with redirecting other tld's, typically we'll redirect a .com to .co.uk - easy stuff.
But I'm stuck with someone who bought these : .co, .com and .co.uk
They want the .co.uk to be primary.
I've sorted the .com like this:
RewriteCond %{HTTP_HOST} ^(www\.)?thedomain\.com RewriteRule (.*) http://www.thedomain.co.uk/$1 [R=301,L]
Which works fine. However, when I do
RewriteCond %{HTTP_HOST} ^(www\.)?thedomain\.co RewriteRule (.*) http://www.thedomain.co.uk/$1 [R=301,L]
I get an infinite loop error, obviously caused by the .co.uk being included in the RewriteCond rule and then redirecting again....
Any ideas how I can resolve this?
-
Wondering if anyone can help - I'm not entirely sure I'm getting this right. Actually, I know I'm, because it ain't working!
I've retrieved a set of pages using cURL, all working fine, and then using a foreach loop to process each page which will either have one main image, or a main image and thumbnails. I've been scratching my head for many hours trying to figure out the logic to get either the thumbnails (and then I can retrieve the bigger images) or just the one big image.
Here's the part of the loop:
if($node->nodeName == 'div' && $node->getAttribute('id') == 'bigImageWindow' && $node->getAttribute('class') == 'hasThumbnails') { // We have more than 1 image, so use the thumbs approach //echo "a:<br />"; $setImageSrc = "a"; } elseif($node->nodeName == 'ul' && $node->getattribute('id') == 'thumbPage0') { //echo "b:<br />"; $setImageSrc = "b"; } if($setImageSrc == 'a') { if($node->nodeName == 'img' && $node->getAttribute('id') == 'largeImage') { $instr_images[] = $node->getAttribute('src'); } } else { if($node->nodeName == 'ul' && $node->getAttribute('id') == 'thumbPage0') { $vnodes = $node->childNodes; foreach($vnodes as $vnode) { if($vnode->nodeName == 'li') { $wnodes = $vnode->childNodes; foreach($wnodes as $wnode) { if($wnode->nodeName == 'a'){ $xnodes = $wnode->childNodes; foreach($xnodes as $xnode){ if($xnode->nodeName == 'img'){ $instr_images[] = $xnode->getAttribute('src'); } } } } } } } }
I know it's a bit long-winded, but the idea is simple. If the page has thumbnails, use those, else, just grab the main image. As you can see from the latest attempt, I'm trying to set a $setImageSrc to process either option a or option b.
At best, I've managed to get all the images, but a duplicated first image - this is due to it reading both the big image AND thumbnails - despite the logic that it should be doing either/or...
Any ideas?
-
Hi,
I've been looking at using slideToggle() in jQuery for expanding hidden content. Unfortunately, to make it pretty standard I have opted to fix the text height, and need to expand to 100% of the content....
slideToggle() performs the required animation, but toggles between coompletely hidden and the starting height...
for($b = 0; $b < $num_bios; $b++) { if(($b > 0 ) && ($b%2 == 0)) { $margins = ' style="margin-right: 20px;"'; } else { $margins = ' style="margin-right: 20px;"'; } ?> <div class="box-wide" <?php echo $margins; ?>> <div class="heading"><div class="icon-bio"><h2>Biography</h2></div></div> <div class="inner"> <h4 class="label">Biography from: <?php echo $this->bios[$b]->book_title; ?></h4> <div class="first_content"id="extra_<?php echo $b; ?>"> <p><?php echo $this->bios[$b]->content; ?></p> </div> </div> <div class="morelink" style="border: 1px solid red; padding-right: 28px; text-align: right;"><a href="#" id="morelink_<?php echo $b; ?>">Read more</a></div> </div> <?php }
This is the loop of boxes, set to min-height of 350px; the content in first_content is set to 230px, which splits the content line nicely. And I know the margins is duplicated, but I'll sort that after.
Then the jQuery thus far:
<script type="text/javascript"> $(document).ready(function(){ // Hide boxes as soon as DOM ready //$('#extra_0').hide(); // Commented to see if it toggled from the set height up but it hid instead, // Toggle the hidden slickbox $('#morelink_0').click(function() { //var id = $(this).attr('id'); // For when I figure this, it's in a loop. //var newid = id.replace("slick-toggle","#extrainfo"); // Same here. $('#extra_0').slideToggle(400); return false; }); }); </script>
Can this be done? The total heights will vary, but the starting point is always 230px; Hence a toggle between a low height and the entire content, whatever that may be.
TIA.
-
Thanks for the reply...
When I hover over the series of thumbnails that another script would generate, they will be inserted via a pre-existing piece of Javascript that changes the image.
The addimagezoom function does work on the initial image, but not on the changed images. I tried to get the url of the images, hence var img_url = document,.....etc.
I'm using noConflict as there is a ton of other jquery stuff going on with this site...
What I'm trying to do is get that var img_url to change the largeimage: <variable here>, which only seems to work on fixed strings rather than a dynamic item.
Hopefully that makes sense?
-
I've got a jquery plugin to zoom on images, which works great. However, as you would hover over a series of thumbnails, another script switches the image.
I've passed that through a hidden element (a bit of an ugly hack, but it works) however, I'm stumped on the last part. Here's my code so far:
<script type="text/javascript"> var stinky = jQuery.noConflict(); var img_url = document.getElementById("null_image"); alert(img_url); stinky(document).ready( function() { // Magnifier stinky('#main_image').addimagezoom({ zoomrange: [6, 6], magnifiersize: [520,384], largeimage: , cursorshade: true }); }); </script>
The addimagezoom utilises jquery, and works on the primary image - but I want to make the largeimage option variable based on the innerHTML value of null_image.
I tried using the var img_url, adding document.getElementById and also by trying +img_url+.
Any ideas or is this possible -to get img_url into the largeimage: '(variable here)',
-
I've seen plenty of examples of jQuery scripts that would allow a user to scroll back to the top of the page, but is there anything that could do the reverse? I have a client who seems to think that everyone who uses his new site doesn't realise that they can in fact scroll DOWN, despite there being a scrollbar...
Anyway, in order to appease the anger of the clients , I need a pointer to anything that would say, move the browser down 500px or so with each click. I can't find anything, and JS is not my language. Pointers welcome, I'm sure I could figure something out.
Cheers in advance!
-
Please be aware - I didn't set this up. Not a problem to alter/edit/nuke though
I have a database with a set of price fields for auctions - with starting, buyitnow, reserve, makeanoffer_min and makeanoffer_auto.
All of these fields deal with financial amounts. None of the amounts will include pence, so it will never have 1.99, but would be either 1 or 2.
All of these fields are set to 'double' in mysql except for the last one (auto) which is set to decimal(10,0).
I believe we've spotted a problem where one item has a reserve of £2,012,000 - but the database has stored the reserve as 2. Is this correct for double?
I don't realy understand single and double-precision numbers, something I'm off to try and figure out.. But any help on formats for these fields would be great.
-
Right, sent code back to client, and they're still getting issues with this form sending either previous or next. I'm stumped. Works on our machines, can't find any solutions.
Here's the code now:
<button type="submit" name="task" class="button validate signup_prev" style="position: absolute; left: 0px;" value="back"></button> <button type="submit" name="task" class="button validate signup_next" style="position: absolute; right: 0px;" value="next"></button>
Any ideas why this doesn't work in IE? Firefox, Chrome and Safari have all tested okay, and our client's getting shirty
-
Well, I'm debugging someone else's code - they've since moved on and left me a whole load of work :-(
-
Many thanks - I will update and test. Just needed confirmation of this. Seems Firefox and Chrome just detect the '<!' and add the '--' - Firebug showed this : <!-- -next-->
Thanks again :-)
-
I've got some buttons, and for sake of reference, they have comments in them to define them, eg:
<button type="submit" name="task" class="button validate signup_prev" style="position: absolute; left: 0px;" value="back"><!--back--></button> <button type="submit" name="task" class="button validate signup_next" style="position: absolute; right: 0px;" value="next"><!-next--></button>
You'll notice that the second one has a typo - my bad. Instead of <!-- it's got <!-
What I'd like to know is can this cause the button tag to stop working? I've got loads of complaints about the next button not working (although it does on my IE8) and am trying to narrow down potential areas of issue.
-
Does anyone know if a mysql database can store registration information on children including:
Name, Age, Date of Birth
along with the Parent/Guardian details which contains:
Name, Address, Contact Number and Email
Just being super cautious, but would appreciate if anyone knows anything about this, as I've spent some time trawling google and getting lost in legalese. It's for a Holiday company, they're all CRB checked, insured, etc, etc... Well established around 15 years +
Simple yes or no would be awesome, any links would be even more awesome, like a pound of bacon.
-
Yup - stoopid filepaths Thanks a lot for your help there!
-
Yes, it's an inifinity loop problem....
Line 43 is : $files[] = $filename;
I've tried this:
$dh = opendir($img_dir) or die('Not found!');
exit;
And it's errored saying it can't find the folder, so I guess it's the wrong filepath. I'll check that out and go from there. Cheers!
-
I'm having real difficulty with something that should simply work...
I've got a script that reads files within a specific folder defined elsewhere. Then it returns the filenames (image files) to an array. Relatively simple, you'd think...
Here's the process loop :
// Read directory for images @$dh = opendir($img_dir); while (false !== (@$filename = readdir($dh))) { if (($filename == '.') || ($filename == '..') || ($filename == 'Thumbs.db')) { } else { $files[] = $filename; } }
There is a maximum of 4 images in each folder. This process will run once per page load.
I have checked my php settings:
memory_limit 256M
post_max_size 64M
upload_max_filesize 62M (just for good measure).
IMHO 256m works for another site I developed which processes up to three images using imagemagick, and I've tested this with a 4mb png file too....
Yet I get this error :
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 35 bytes) in F:\html\bishopstrings\components\com_content\views\article\tmpl\default.php on line 43
This is telling me it's trying to allocate 35bytes when there is 268435456 bytes available...
Yet this fails - any help
-
Hey, would you look at that. It works!!!
Thanks very much guys, you've saved my hair - only to let it go greyer....
-
Sorry, I was a bit vague
Basically, in Firefox, the element paypal_details will show on a onclick event, but not hide when the element is clicked again. This works in other browsers, but not FF. I have firebug installed, but it doesn't show any errors when it fails to hide the div.
As for value, I'm sure that can be removed. It wasn't working before I added that, and still didn't work afterwards, so I don't think thats the issue.
Thanks
-
Works fine in other browsers I've tested so far (Chrome & Safari)
<script type='text/javascript'> // TODO - this does not work if FF - other browsers are fine. function showPaypal(paypal_value) { var src_value = paypal_value; var target = 'paypal_details'; var settingvalue = document.getElementById('showpal_value').value; if(src_value == 'on') { document.getElementById('paypal_details').style.visibility = 'visible'; } else { document.getElementById('paypal_details').style.visibility = 'hidden'; } alert(document.getElementById('paypal_details').style.visibility); } </script>
The html bit is this
<input type="checkbox" name="showpal" id="showpal_value" onclick="showPaypal(value);" <?php if($agent_show == 'checked') { echo "checked=\"checked\" "; } ?>/> <?php echo $agent_show . "<br />"; ?> <div id="paypal_details"> <?php echo $paypal_code; ?> </div>
I can't see anything technically wrong, and it's from a tutorial (modified to suit my needs). Sorry for all the JS questions, but it's not my strongest point, though I am learning quicky!
-
Hi,
I'm tryign to do a simple (!) function to calculate the total of a group by male/female.... This will display a total that is used to book places in that group, and the male/female count is required.
Here's the code so far:
<script type="text/javascript"> function addTotal() { var boyval = document.getElementById('boyval').value; var girlval = document.getElementById('girlval').value; var memtot = document.getElementById('memtot'); if((boyval == null) || (isNaN(boyval))) { var boyval = 0; } if((girlval == null) || (isNaN(girlval))) { var girlval = 0; } var boyval = parseInt(boyval); var girlval = parseInt(girlval); alert(boyval); alert(girlval); memtot.value = boyval + girlval; } </script>
However, I type in say 3 males, and the total is coming up as NaN, something I thought I'd covered. How can I get this to do :
1. Total of the two entries if they have numbers entered?
2. Total of the two entries if either one or the other is blank?
(There is separate empty form error checking, which works off the total.
TIA for any help
-
Exactly what I was thinking - I have two forms, one which uploads a couple of images (album art) and then the next one uploads the mp3's (music site). They can then go back and upload alternative art (I guess) but it's mainly if there is a typo in the title/desciption, etc
Cheers.
-
Thanks. That confirms a few fears I had. Guess I'll have to look for a different system as I may need people to return to a form which has files marked for upload.
Cheers.
-
Maybe I don't ask questions right:
<input type="file" /> - can I do the following:
Set a value="filename"?
Stop the input from stripping location data - eg : C:/Documents and Settings/<user>/Pictures/image.jpg becomes image.jpg. I may need to reinsert this value using php and it's stripping the complete file url.
Assign a separate class for the browse button - actually are there any settings for it at all?
Sorry if these sound dull/noob, but googling for me returns stuff about ASP, Java and I just want plain html answers so I can import my php to it.
-
Never mind, digging around see that JS doesn't read local files correctly, people are exploiting IE flaws. Guess I'll move the file to a temp location on the server then render a preview.
FPDF rendering of worldwide places
in Other Libraries
Posted
Hi,
Tearing my hair out with this one, it seems that the inevitable choices of solutions are both intensive pieces of work.
I've created a delivery/invoice note generated by FPDF from a shopping cart object in PHP. It's fine, it's been working well, some teething issues and then this:
We had some orders from abroad, namely Saudi Arabia and Israel. The system uses country codes which are sent to the payment gateway, and the system also determines regions within a country as linked drop-down list with country.
So, in one example, someone has selected Israel, and some indecipherable region/state within Israel.
This renders in the PDF as:
מחוז המרכז
Which is no good to anyone!
So I tried to convert DejaVuSans (as recommended in a St***k O******w thread) using the makefont tool, using CP1252 encoding, which is the default. No luck. Tried with ISO-8859-1 - still no luck. Also reran versions with utf8_encode (and utf8_decode just to see what it would do - I was getting desperate at this point). Nothing. The best I got was:
???? ?????
Which showed me that FPDF is generating the region - country parts of the address.
I now have two options:
1. Convert every non-english address using english characters. A massive job as the cart system doesn't do this, but has the capability (?!?)
2. Create a pdf system for each encoding type - something I would like to avoid too, as some of them may never place orders.
The ideal solution, and my question is - is there a font or way I can render foreign character sets without determining the encoding of the PDF?
Hope that all makes sense.
tl:dr - Can't make fonts work in FPDF for foreign places. Want one solution that doesn't involve masses of work editing databases or files.