johnnyjohnny
-
Posts
14 -
Joined
-
Last visited
Never
Posts posted by johnnyjohnny
-
-
How to convert "media/browse?key=hello" to "control/media?r=browse&key=hello"?
Thanks in advance.
Tried:
RewriteRule ^([^/]+)/([^/]+)?([^/]+)$ control/$1?request=$2&$4 [L]
Didn't work out.
-
Is it possible to turn "control/test/hello?you=me" into "control/test?request=hello&you=me"?
Tried using: RewriteRule ^control/(.+)/(.+)\?(.+)$ control/$1?request=$2&$3
Please help me.
-
I understand that, but to me this way it's nicer as "request" is implied.
It seems you are trying to add more parameters onto an already rewritten url. I don't think this is possible.
Paramaters start with ? i.e. http://dsfsdf.php?
As the position of this has already been defined in the rewrite rule adding another after params will no work.
If the url is not using the rewrite then you can use as many paramaters as you like ie.
control.php?request=hello&you=me
-
Is it possible to turn "control/test/hello?you=me" into "control/test?request=hello&you=me"?
Tried using: RewriteRule ^control/(.+)/(.+)\?(.+)$ control/$1?request=$2&$3
Didn't seem to work.
Thanks for any help. ???
-
That's interesting, do you mind elaborate more on that more?
I'd recommend either using a $_GET var then, or using htaccess and modrewrite to just take whatever is after the slash
e.g. http://foo.com/additionalinfo
a combo of modrewrite and $_SERVER['REQUEST_URI'] should accomplish the same goal and actually look cleaner.
-
Not quite, the site I am working on is complete Ajax based, and the problem I ran into is the back/forth button and bookmark will not function, so to correct that the server side is going to catch the "#" part and decide what to display, so sadly it has to be processed on the server side.
very weird...
but you can use JavaScript insted PHP...
use this code to print the url:
<script language="javascript" type="text/javascript"> document.write (document.location.href); </script>
-
That's will only print "/" for me.
yes
echo $_SERVER['REQUEST_URI'];
-
is it possible to catch full php url, like this one? especially the part after #.
http://foo.com/#additionalinfo
thanks
-
I don;t quite understand.
p.s. it's not OOP.
If the variable isn't already defined, I'm pretty sure you need to use the __set() magic method.
public function __set($index, $value){ $this->$index = $value; }
And what you have there doesn't look like OOP, unless you've just copied the functions from your code.
-
That's what I thought, but surprising no.
-
I want to establish the similar setup Rails has, MVC, controller gets request, retrieves the model, view uses the model to output html.
What is the best way to pass the model variable from the controller script to the view script? (view function is called within controller script)
i.e.
//controller
<?php
$model = new User();
$model->user_name = "johnnyjohnny";
$output_html();
?>
//view
<?php
function output_html() {
echo "<div>$model->user_name</div>"
}
?>
how to pass model from controller to view?
thanks in advance
-
You guys are the best.
@Crayon Violent:
The reason why i don't want to hardcode " with \", which is what I did, I guess is because the html inside the foo() function would seem identical to its html counter-part. Again, thank you very much for your reply.
Why not just escape the quotes inside the function in the first place?
But anyways, in order to add slashes, you have to put the html in a variable first. You can add the addslashes(...) inside your function but if you're going to do it there, then ^^ why not just hardcode that way in the first place. If you're wanting to do it outside of the function, you can do something like this:
function foo() { $string = <<<STUFF <div id="hello"> hello </div> STUFF; return $string; } echo addslashes(foo());
but if you're going to be doing that all the time anyways, then we're back to square one, in that why not just hardcode it that way to begin with
-
Question:
Say I have a include file with a function that produce html
//include.php
<?php
function foo() {
?>
<div id="hello">
hello
</div>
<?php
}
?>
and another file calls the foo() function
//controller.php
foo();
Is it possible to add slashes to the html produced by foo() in controller file? i.e. turn <div id="hello"> to <div id=\"hello\">
I tried to use addslashes(foo()), didn't seem to work
thanks for any help
HELP! RewriteRule
in Apache HTTP Server
Posted
I meant to ask how to convert "media/browse?key=hello" to "control/media?request=browse&key=hello"?
And what i have now is:
RewriteRule ^([^/]+)/([^/]+)?([^/]+)$ control/$1?request=$2&$3 [L]