
defeated
Members-
Posts
246 -
Joined
-
Last visited
Everything posted by defeated
-
Really basic stuff.... may not be a php solution
defeated replied to defeated's topic in PHP Coding Help
Ok, I think I wasn't clear enough about the db. It doesn't have any individual page details... rather they are job descriptions that I then fit into a template. At present the title for those pages is a mixture of text and details from the db eg <title>Job Details for <?php echo $jobtitle ; ?></title> where $jobtitle is the result of a MySql query. But not all my pages are from the database for example my home page, about page, contact page. These would have to have another solution. Maybe I have to use a mixture of both methods. (get and switch). -
Hi, This is about <title> tags. The Problem: How to have a different title tag on each page of my site. The Complication: I have a separate Header.php file which I use "include" to attach to my page. This file has most of my page structure in it ("include('footer.php') has the rest). I have been using <table> as the structure for the site so each page is just a <td> cell in the structure... not that I realised it to start with. I was treating each page as a full page complete with head section..... it worked but it's a million miles from correct syntax. I was thinking I could use "switch" to change the title depending on the page but there is a futher problem. I have dynamic pages based on a mysql db. These pages could potentially change several times a day and keeping up with the changes with my switch switch is not practical. I'm looking at changing the site structure to <div> but I am just at the very first stages of finding out how <div> works. Am I wasting my time with that or am I going in the right direction? Is there any difference when it comes to the <head> and <title> in particular? ???
-
Cheers for that. I think I'll forget adding in the header and footer separately for a while.... put the whole thing together for each page and that will rid me of the <title> problem and the extra <head> and <body> tags. I was going to just write in some php but it was getting messy when it came to dynamic pages. I'm off to find out about css and <div> to redesign the site from scratch..... not so much the layout as the code that makes the layout. Got rid of most of the validation errors through a mixture of editing and changing the doctype. That validation site is great. I had a look at one of the best known and biggest job sites in Ireland on it and they had 355 validation errors!! That made me feel a lot better about my 113. There again another big one had none at all. does validation effect google ranking? Thanks for the clock code. Not using it because what is the use in a clock that doesn't tick? But It is useful to me anyway as it is an example of css and <div>. When I get a bit of time I'll look at it again and try and adapt it to the java I'm using. To be honest I don't even like the clock.... not my idea. Pagination will be introduced to the job page when necessary I just hope I have time to find out how before it is necessary. Then again.... there is always timely advice here when I need it. By the way..... what doctype is most up to date and will let me do most? My current validation won't let me add margin attributes to the body tag but if I get rid of them the site slips down the browser window on the background leaving whitespace above the logo.
-
113 errors!!!!! omg!!! What exactly is a validation error anyway? How do I find them all? Is that on one page or the whole site? Just been going through the structure and seems like I have some major issues there... 2 tables that start without finishing to start with! I'll sort that out. The reason I have two <head> sections is because I have been treating each page as a separate entity and forgetting that I had include('header.php') and include('footer.php') in there. Or to be more honest I thought I could do it that way. This raises fresh issues. Each individual page has important stuff in it's own <head> section but I also need the info in the <head> section of the header.php file. How do I get around that? I will change the clock as soon as I find out what a span or a (forgotten what the other thing was temporarily) is. I should point out that last october I couldn't write a single line of html. It's a steep hill to climb. Should I change the structure completely.... eg find out what <div> is all about (haven't a clue right now but I keep seeing it in places). Are tables the wrong way to go? The boss likes the grad background though so it stays! Many thanks for such an informative critique!!!! I'm impressed. Ian. Is it salvageable?
-
Thats done it nicely Paul. Many thanks. Ian
-
Nice looking site. Your sidemenu buttons are slick.... may have to borrow them at some stage. One problem I found.... When I entered the site I was on a booking page. Once I'd left it for a look around I didn't find it again. Presumably it's the most important page you have so why not have links EVERYWHERE for dumb blind people like me who just leave the site instead if things aren't super easy. Also.... I'm not sure how confident I'd be flying with a pilot with no hours..... Change that quick! Pilot rank insignia is nice but how about a legend at the top to tell non pilots like me what they mean. Didn't spend a lot of time looking.... lost me in about 3 mins. If I'm a customer give me a clear customer area. Ian.
-
Hi all, This is my first site so go easy on me please!! A friend gave me the bare bones but there is barely a line of code that hasn't been changed since. All critiques gratefully recieved even if I ignore them entirely. I am planning some changes but being a noobie, it all takes me a hell of a lot of time. Spent ages and ages on the cms behind the jobs page and still have more work to do there on how info is stored and displayed. I guess I am looking for suggestions about being user friendly, ease of use, and where to take it from here. I am intending placing a "hot jobs" section somewhere on the home page (maybe in the side menu instead of the clock or under it using "Get and then if pgurl=index etc" to make sure it only shows up on that page.) And as the company grows I will need to adapt the jobs page to accomodate more jobs and make the db searchable. The site is http://www.jackiebrownmedical.ie Thank you all in advance And thank you to all who have helped me so much along the way to this point. This is my favorite site on the Web right now.
-
Forgot to write.... I called the Sitemap "sitemap.php", stuck it in the same directory as my homepage and then submitted it to google. All done and dusted. 74 url's submitted just like that.
-
ok.... here it is. it is a jobs website called www.mysite.ie so lets assume that all jobs are kept in a MySql table in the db called mytable and they have a unique identifyer column called "unique_id_column" and a date column, that updates with the current date on every change of information in the row, called "up_date_column". I only keep the jobs showing for 30 days from the last update so you may need to modify the mysql selects. Hope it helps. It contains static pages too which I update manually since I don't change them that often. <?php //make a mysql connection mysql_connect("localhost", "user", "password") or die(mysql_error()); mysql_select_db("mydatabasename") or die(mysql_error()); header('Content-Type: application/xml'); //tells browser that content is xml echo '<?xml version="1.0" encoding="UTF-8"?>' ; ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://www.mysite.ie/</loc> <lastmod> <?php $sql = "SELECT MAX( up_date_column ) as date FROM mytable"; //selects latest date of anything that was updated in the table 'mytable' and sets that as the last mod for home page. using this here because I have a dynamic scroller on this page based on the db contents. $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); echo $row['date'] ; ?> </lastmod> <changefreq>Monthly</changefreq> <priority>0.9</priority> </url> <url> <loc>http://www.mysite.ie/contact.php</loc> <lastmod>2008-03-14</lastmod> <changefreq>Monthly</changefreq> <priority>0.5</priority> </url> <url> <loc>http://www.mysite.ie/about.php</loc> <lastmod>2008-03-14</lastmod> <changefreq>Monthly</changefreq> <priority>0.6</priority> </url> <url> <loc>http://www.mysite.ie/jobs.php</loc> <lastmod> <?php $sql = "SELECT MAX( up_date_column ) as date FROM mytable"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_aarray($result); echo $row['date'] ; ?> </lastmod> <changefreq>Daily</changefreq> <priority>1.0</priority> </url> <?php $result=mysql_query("SELECT * FROM mytable WHERE TO_DAYS(NOW()) - TO_DAYS(up_date_column) <= 30")or die(mysql_error()); //I only display each job for 30 days past last update. while($row = mysql_fetch_array($result)) { ?> <url> <loc>http://www.mysite.ie/jobdetails.php?id=<?php echo $row['unique_id_column']; ?></loc> <lastmod><?php echo $row['up_date_column'] ; ?></lastmod> <changefreq>Weekly</changefreq> <priority>1.0</priority> </url> <?php } ?> <?php $result=mysql_query("SELECT * FROM mytable WHERE TO_DAYS(NOW()) - TO_DAYS(up_date) <= 30")or die(mysql_error()); while($row = mysql_fetch_array($result)) { ?> <url> <loc>http://www.mysite.ie/applyform.php?id=<?php echo $row['unique_id_column']; ?></loc> <lastmod><?php echo $row['up_date_column'] ; ?></lastmod> <changefreq>Weekly</changefreq> <priority>0.7</priority> </url> <?php } ?> </urlset>
-
See that's where I come unstuck. It doesn't go...... $result=mysql_query("SELECT * FROM mytable WHERE id=12")or die(mysql_error()); $row=mysql_fetch_array($result); $mytimedatefield=$row["DATE_FORMAT( mytimedatefield, '%d-%m-%Y )"] ; echo $mytimedatefield ; But you get the idea of what I'm trying to do here.
-
Cheers for that... I now have a shiny new Sitemap and google hasn't rejected it. I'll clean the code a bit then post it here in case it's of use to someone..... will be about 24 hrs til I get a chance though. Happy days.
-
Fenway, Further to last post. I'm just wondering if it's possible. I reckon the second question probably requires java about which I know even less than I know about php and mysql (yes that's possible). I have an idea in my head of how i'd like it to work in a user friendly if not programmer friendly fashion but I'm open to suggestions. Ian.
-
Fenway, What I'm looking for is two things. The expiry date column is called expiry_date First: Insert.......... "values(now() + INTERVAL x DAY)" where x=$_REQUEST['number of days to expiry from form'] ; It's a syntax problem. I don't know what to put where. Second: Update.......... $row[expiry_date]+ INTERVAL x DAY I will have an "<a href=update.php?id=<?php echo $rowid ; ?>>update</a>"on my cms page. Ideally I want to have it so that just clicking the anchor displays a dropdown list of select options (days 1-60) that can be chosen without leaving the page and selecting the number from the list activates the anchor and also passes the selected number of days along with the row id? I'd settle just having the select in update.php?id=<?php echo $rowid ; ?> where the submit would go to update1.php?id=<?php echo $rowid ; ?> and then I need the correct syntax for the line "update..... $row[expiry_date etc. Crap I'm confusing myself now.
-
Hey Paul, I think that's close to what I want to do. Only problem is the date format... want to keep it the same way as mysql eg 2008-03-17 and only change the format if I'm echoing it out to a html page. Does this work or am I way off? <?php $number = 3; $today = strtotime("NOW"); $then = strtotime("+ $number Day", $today); //adds the number of days onto now $date = date(date("Y-M-D ", $then); echo $date; //prints out 2008-03-17 ?????? ?>
-
So thats... <?php echo DATE_FORMAT( yourDateTimeField, '%d-%m-%Y ) ; ?> Is that right?
-
Hi, When I output a date from mysql into a html page how do I change the format from 2008-03-14 to 14-03-2008 in the display? Also if it is timedate in the db how do I do the above and also delete the time part in my output?
-
Hi, I have a form where one of the selects is number of days before data expires. Problem is I have no idea what the syntax should be to set the expiry date (expire_date column) as now() plus x days where x is the inputted number of days selected in the form. ??? It's probably easy but not to me right now.... can't find how to do it anywhere. Further more I want to be able to update the expiry date if the data is expired by another x days without showing the whole form again. ie, have a column in the outputted display of all data (expired and current) in my cms that allows me to click on it and a select of days is shown that where I can click on the day number (1-60) and it automatically updates the expiry colm to x days hence. With me?
-
yay I think that means I'm nearly done.... will have to check out the iso standart from Sitemaps.org and check that my mime types are ok... It can't really be straight forward like that can it? Nothing else has been so far!
-
Yup. Your <?php blah blah blah ?> can go anywhere on the page. It sounds like you are about at the same stage as I am with php so keep things simple and call all your pages with php in them '.php' rather than anything else. The other comments are just showing off!!!
-
Hi, I want to make a sitemap but a large part of the content of my site is dynamic based on a mysql database. I understand how to write the php to insert each page using 'while' but what I don't get is how to write the results to an xml file. If I use php then the page has to end '.php' rather than '.xml'. Is that a problem? I am also not sure if the mysql now() datetime format is right for the correct Sitemap.org format. If not how do I change it. I looked for free sitemap generators but was unclear if any of them would work with my database properly. I have static pages that I don't need to script for to be dynamic and they can be in plain flat xml format. I don't mind updating the sitemap manually for static pages because it will be once in a blue moon that I add or delete them. The other reason I don't want to use a generator is because by doing it myself I might learn something. Finding it hard to get good info on what to do though. All help recieved gratefully. Ian.
-
That sounds sensible! Will do.
-
Rhodesa, You da man!!!! McGyver had nothin' on you. I feel a bit like this.... ;D ;D ;D ;D ;D ;D ;D ;D ;D I can't possibly thank you enough. I hope I can help out someone else the same way some day.
-
It works like a charm! Just one more question.... Do you have to end sessions or are they timed or what? Don't think it's important.... just want to make sure it isn't.
-
I've mailed my provider for permissions to be turned on. Will keep you posted. It should just work then shouldn't it? Thank you so much once again. Ian.
-
Hi Rhodesa, Thanks once again for your input. unfortunately it is returning the following:- Warning: move_uploaded_file(.tmp_upload_24310) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/j43012/public_html/postjob/mailer.php on line 30 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpHsJwxw' to '.tmp_upload_24310' in /home/j43012/public_html/postjob/mailer.php on line 30 Failed to move uploaded file to .tmp_upload_24310 I don't know if that means anything to you.... it certainly doesn't to me! Tried moving it to the root folder too but no difference. (it's only in the postjob folder because that is where I put stuff I'm working on ..... it's password protected and keeps out googlebots. I know it wasn't the right way of doing things and maybe wasn't very secure but at least the first way worked.... appart from showing up with the tmp name instead of the file name. I would do or try anything at this stage. Thanks again.