l_l shares
17 years ago
pastie.org/224276 - Maybe some PHP minded person (I've bothered Chris enough today) can help me out with this code.
latest #48
l_l
17 years ago
The only part I've edited is the "new_slug" code, currently it causes the page its used on to be blank.
Chris
17 years ago
Would be nice if pastie was actually available today to see the code. :-P
l_l
17 years ago
Well, I did post it here
立即下載
Chris
17 years ago
What still needs to be done? Incrementing?
l_l
17 years ago
Thats what my code is supposed to do. Problem is, it breaks the webpage, for some reason.
Chris
17 years ago
For that last for() in new_slug(), should that + be a period?
l_l
17 years ago
I dunno. I made it like a java program, but all the variables have $ in front of them.
l_l
17 years ago
Hold on, should both the pluses be .'s? I'm trying to add all of the characters in the array together to return them.
Chris
17 years ago
No, within the for() loop. Between the brackets. { }. Periods concatenate strings in PHP. (if that's what you're trying to do).
l_l
17 years ago
Right, thats what I'm asking. In the last for loop, should both the pluses be .'s or just the first one?
l_l
17 years ago
Nope, didn't help
l_l
17 years ago
pastie.org/224428 I modified it a little bit.
Chris
17 years ago
btw, PHP doesn't require brackets. How you had it was fine. Does it work?
l_l
17 years ago
No. I just added the brackets for readability. But what I'm wondering is, why would a screwp in the code affect whether the webpage shows up
Chris
17 years ago
Try adding this towards the top: error_reporting(E_ALL);
Chris
17 years ago
It'll point out whatever error is there.
l_l
17 years ago
the top of the new_slug or the entire class?
Chris
17 years ago
Just after <?php
l_l
17 years ago
Still nothing on the webpage.
Chris
17 years ago
Line 97 from the pastie should have two = signs. if($char_to_increment == -1)
l_l
17 years ago
Nada.
Chris
17 years ago
(well, that wouldn't cause the script to crash. I was just pointing it out. :/ )
Chris
17 years ago
For that last for(), you can just use $first = implode("", $all_char);
l_l
17 years ago
Ok, I put the error reporting thing in common.php and something showed up. Woo.
Chris
17 years ago
Found the error: $slug = $this->();
Chris
17 years ago
Well, guess you beat me to it. :-P
Chris
17 years ago
Should be:
Chris
17 years ago
$slug = $this->new_slug();
l_l
17 years ago
Ok, still not quite fixed...xn--12-c6t.ws/?c=http%3A...
l_l is
17 years ago
there a special way to compare characters?
Chris
17 years ago
if(a == b) ?
Chris
17 years ago
I can't think of any other way.
l_l
17 years ago
Well, its giving me an error with this line if($all_char[$num] != $final_char)
l_l
17 years ago
Uninitialized string offset?
Chris
17 years ago
Looks like you have an infinite loop. Can you pastie the file?
l_l
17 years ago
Shit, put ++ instead of --
Chris
17 years ago
:-P
l_l
17 years ago
Do you know if any of the errors that show up on the page are worriesome?
Chris
17 years ago
Um, I don't know. I need to see the file.
Chris
17 years ago
The missing argument isn't serious, and the undefined variable is easily fixable.
l_l
17 years ago
Okay, the page has no more errors, but now it keeps returning the same URL...This is mine though, not a PHP error.
Chris
17 years ago
What do you mean? Looks fine to me.
l_l
17 years ago
Figured it out. >= rather than =. ½.WS now has the shortest urls eva.
Chris
17 years ago
:-D
l_l
17 years ago
Hopefully it will rotate to two characters when the time comes. But, I must say Chris, this would not have been possible without you.Thanks!
Chris
17 years ago
Does it increment alright?
l_l
17 years ago
well, it goes from a to b to c so far, but I want to see if it goes from - to aa
back to top