Jump to content

Kane250

Members
  • Posts

    230
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Kane250's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Gotcha! I ended up including the file via the file system and I turned my code into a function that I just query after inclusion to get my data. This seems to be working perfectly. Thanks everyone!
  2. Hi all, I'm at a dead-end here. I have a php file that I can query to return an array containing a bunch of data about a job listing. I include and query it by calling it like so within another file on my site. Quick Notes: The original file is in a different directory on my site than the page it's being included in. I have tried returning the array at the end of the script. I can print_r the array on the page I'm including the script on (so the URL path is correct). If I go to this URL directly and print_r on the array, I see the entire array as expected. Also, if I include the file on page 2 like I did above with print_r on the array in the original file, I see the array printed out on page 2. include 'http://www.example.com/php/job-details.php?job=jobname&city=thecity'; However, if I do not print_r on the array in the original file and just include it on page 2, I cannot do anything with it and the array variable isn't found. Is this a case of variable scope? I'm so frustrated... Here is the code I have in my original file: <? include('functions.php'); $jobtitlematch = $_GET["job"]; $jobcitymatch = $_GET["city"]; //echo $jobtitlematch; //echo $jobcitymatch; $url = 'http://somesite.com/something'; $xml = simplexml_load_file($url); foreach($xml->job as $job) { $jobtitle = makeURL((string)$job->title); $jobcity = makeURL((string)$job->region); if ($jobtitle == $jobtitlematch && $jobcity == $jobcitymatch) { $jobdata[] = array( Title => ((string)$job->title), URL_Title => makeURL((string)$job->title), Location => ((string)$job->region), URL_Location => makeURL((string)$job->region), Department => ((string)$job->department), URL_Department => makeURL((string)$job->department), Overview => ((string)$job->joboverview), Responsibilities => ((string)$job->responsibilities), Qualifications => ((string)$job->qualifications), Keywords => ((string)$job->metakeywords) ); } return $jobdata; //I have also tried return global $jobdata; } print_r($jobdata); ?> Thanks in advance for any help you can provide...
  3. Well the website it's being displayed on is in a UTF-8 character set. Is it easy to convert?
  4. I get this output: Items Array ( [0] => � the first thing � the second thing � the third thing � etc � etc )
  5. Did you test that? For me it just throws everything into the first array index...
  6. Any way to explode on bullets? I know it's a special character, but I can't figure it out $manyItems = "• the first thing • the second thing • the third thing • etc • etc"; //This doesn't work $items = explode("•", $manyItems); //Neither does this $items = explode("•", $manyItems); Any suggestions? Thanks in advance!
  7. Thanks. Since it seemed like the only way to do this was to make a landing page, I actually ended up going for the easier route and just passing a variable through the forwarded URL. It's not as clean, but I think it's as simple as I can make it work at this point. Thanks for your help.
  8. Yes were doing a standard 301 redirect, but this still doesn't work...
  9. Well I'm trying to find out from my IT dept here if it is being done a different way, but I do believe that it is a standard 301 redirect. The urls come in from other pages, and even if I click back to the homepage from an internal page on the site. The only undefined one is when I get redirected from the other domain.
  10. Hi, I have a website set up with two domain names, 1 main domain for the site, and 1 that forwards you to the main domain name. I'm trying to set a variable where I can do one thing if you came to the normal url or do another if you were forwarded from the redirecting url. To make it a step harder, I don't want to do the simple solution and pass a GET variable from the redirect url to the main page. I tried using echo $_SERVER['HTTP_REFERER']; But this obviously doesn't work with domain forwarding, as I am getting an undefined variable error. Anyone know of other methods? Thanks in advance!
  11. No, I couldn't because this wouldn't be dynamic anymore. I would have to set reference numbers for each entry in the code, defeating the purpose of what I'm trying to do. But thanks for the suggestion.
  12. The code really won't help much in this case because it's a general question, plus I am using expression engine, which is like php but simplified. Anyway here is the requested code. {exp:weblog:entries weblog="events" category="24" orderby="eventstartdate" rdf="off" sort="asc"} <div class="hidden"> <input type="hidden" name="eventname" value={eventname}> <input type="text" name="firstName" class="formTextBox" onFocus="clearText(this)" onBlur="clearText(this)" value="First Name" /> <input type="text" name="lastName" class="formTextBox" onFocus="clearText(this)" onBlur="clearText(this)" value="Last Name" /> <input type="text" name="company" class="formTextBox" onFocus="clearText(this)" onBlur= "clearText(this)" value="Company Name" /> <input type="text" name="email" class="formTextBox" onFocus="clearText(this)" onBlur="clearText(this)" value="Email" /> <input type="text" name="phone" class="formTextBox" onFocus="clearText(this)" onBlur="clearText(this)" value="Phone*" /> </div> {/exp:weblog:entries} Basically what's happening here is that a loop is started at the top where the {exp:weblog} tags are, and it is returning a list of all these events I have entered into a pseudo-database kind of system. The loop repeats everything between the opening {exp:weblog} and the closing {/exp:weblog}. Variables look like {eventname}. This is expression engine. I am not asking for help with expression engine, I'm asking for help with logic. I can add php to this if I want to. The result of what I get here is over 15 hidden divs with duplicate text form names. Clearly, to POST any of this info to another page, the form names need to be consistent. If I do the first thing that comes to mind: <input type="text" name="{eventname}"... Then these won't register on the page they need to post to. All the names would be dynamically created, yes, but they would serve no purpose. I can pretty much do anything in expression engine I can do with php, so I am looking for some solid logical way to do this from anyone who has ideas. Thanks!
  13. Yes, you're correct. I am creating unique ID's now by passing the event name as the id, but the names are a problem (according to w3c), and if I create unique names, how will the database I submit to know what is what? I would post code, but it's not actually php, it's expression engine which is run on php I believe, but not the same exactly.
  14. This is an odd question. I'm actually doing this in expression engine, but it functions as if I was doing it in php, so I wanted to ask here. I have a page that has a list of events on it. When the page loads, I basically run a for loop that creates hidden divs, each containing their own registration form for the specific event. The div is shown with a button click in javascript, and the user fills out the form, which is dynamically pre-filled with all the information for that specific event. Here is my issue. I am echoing the same form for each event on the page, therefore the input names and id's are duplicated for each form that is created for each event - resulting in tons of duplicate names and id's when i check w3c validation. I'm totally stumped on how one would go about organizing this in a way that can be just as dynamic, but be able to submit the form data with consistent names, without breaking validation. Any ideas or examples anyone can provide? Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.