addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrosseditemptyheartexportfacebookfolderfullheartglobegmailgoogleimageimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

JaxPHP / JaxWeb Message Board › question about dynamic folder structure

question about dynamic folder structure

A former member
Post #: 1
I have been working on a site that has a dynamic folder structure. that seems to be working fine, the problem that i am having is with $_session variables not showing up on this pages and some of the php is not working correctly.
I have a sentence that pulls the keyword that was used to reach the site and insert it into the sentence. it only goes to the default value.

this is the code that is doing that.

Do you have <?PHP $termKW = $_REQUEST["utm_term"];$titleKW­ = isset($_REQUEST["utm_actual_term"­]) && !empty($_REQUEST["utm_actual_term"­]) ? trim($_REQUEST["utm_actual_term"­]) : ""; $termKWS=preg_replace('#-|>|!|/|,|\.|­www|problem|problems#',' ',$termKW); $titleKWS=preg_replace('#-|>|!|/|,|\.­|www|problem|problems#',' ',$titleKW); if( $titleKWS == '') { $titleKWS = !empty($termKWS ) && strlen($termKWS)<21 ? $termKWS : "Tax Debt";} else{ $titleKWS = strlen($titleKWS)<21 ? $titleKWS : "Tax Debt"; } $titleKWS=preg_replace('#(\{|\})#','',$t­itleKWS); $titleKWS = ucwords(strtolower($titleKWS)); echo $titleKWS; ?> Problems? We can Help!

it seems to work fine on the template page and any static page that i place it on. just when it has a long folder structure it doesn't seem to work. any ideas why this might be happening?

thanks for taking the time to look at it

Brian
A former member
Post #: 9
First I'm going to expand this so it's easier to read...


Do you have

<?PHP
$termKW = $_REQUEST["utm_term"];
$titleKW = isset($_REQUEST["utm_actual_term"­]) && !empty($_REQUEST["utm_actual_term"­]) ? trim($_REQUEST["utm_actual_term"­]) : "";

$termKWS=preg_replace('#-|>|!|/|,|\­.|www|problem|problems#',' ',$termKW); $titleKWS=preg_replace('#-|>|!|/|,|\.­|www|problem|problems#',' ',$titleKW);

if( $titleKWS == '') {
$titleKWS = !empty($termKWS ) && strlen($termKWS)<21 ? $termKWS : "Tax Debt";
}
else{
$titleKWS = strlen($titleKWS)<21 ? $titleKWS : "Tax Debt";
}

$titleKWS=preg_replace('#(\{|\})#','',­$titleKWS); $titleKWS = ucwords(strtolower($titleKWS));

echo $titleKWS;

?> Problems? We can Help!
A former member
Post #: 10
Brian,

How long are we talking about?

Are there possibly any illegal characters?

A former member
Post #: 10
Hi Brian,

I see in your original post you say you're having trouble with the $_SESSION values, but it looks like your code is using $_REQUEST, which will only have values in it if POST or GET varaibles were posted to the page. You might need to map the $_REQUEST variables into $_SESSION so you have continued access to the values?
A former member
Post #: 102
I hope this helps Brian, most the time when stuck I find I just needed a memory jogger from Allan to get my mind working again.

You refer to $_SESSION but the code uses $_REQUEST (POST, GET and COOKIE (in older php ver)) as if it is getting input from the client browser side. The statement how they reached the site makes me think $_SERVER['HTTP_REFERER'] but the regex does not coincide with that idea, so possibly in the URL as a GET? If it is session then a session_start() would be required before any HTML to be able to see the session data.

The script only does / outputs this:
Do you have KEYWORD else Tax Debt Problems? We can Help!

I know we are not seeing the whole picture and I would suggest looking at the difference between the static that works and the dynamic and what is being done differently to make it not work.

- are the inputs / variables (keyword) getting to the script? (this was your stated problem)
(comment out the regex code and test that the input is making it with an echo or a print_r($_REQUEST))


Tim
ZipOnOver, Local business tools

The part of dynamic folder structure controlled by user input scares me.

Powered by mvnForum

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy