-
Posts
237 -
Joined
-
Last visited
About ozestretch
- Birthday 10/03/1976
Contact Methods
-
Website URL
http://www.stretchit.com.au
Profile Information
-
Gender
Male
-
Location
Australia
ozestretch's Achievements
Member (2/5)
0
Reputation
-
Sitemap list from multi dimensional array
ozestretch replied to ozestretch's topic in PHP Coding Help
Thanks trq, made me revisit the way I was thinking. I got it to output as desired, but am wondering if it is efficient.. thoughts? <?php $output = new GetSitemap('html'); $sitemapout = ""; foreach($output->sitemap as $categorykey => $value){ $sitemapout.= " <li><strong>".ucwords($categorykey)."</strong> <ul class='first'>\n"; // loop first level pages - status = 2 foreach($output->sitemap[$categorykey][2]['title'] as $cat2key => $cat2value){ $sitemapout.= " <li><a href='{$output->sitemap[$categorykey][2]['url'][$cat2key]}'>{$cat2value}</a></li>\n"; } // loop second level pages - status = 1 $l2 = 0; foreach($output->sitemap[$categorykey][1]['title'] as $cat3key => $cat3value){ if($l2==0){ $sitemapout.= " <ul class='second'>\n"; } $sitemapout.= " <li><a href='{$output->sitemap[$categorykey][1]['url'][$cat3key]}'>{$cat3value}</a></li>\n"; $l2++; } if($l2>0){ $sitemapout.= " </ul><!--// second //-->\n"; } // loop third level pages - status = 0 $l3 = 0; foreach($output->sitemap[$categorykey][0]['title'] as $cat4key => $cat4value){ if($l3==0){ $sitemapout.= " <ul class='third'>\n"; } $sitemapout.= " <li><a href='{$output->sitemap[$categorykey][0]['url'][$cat4key]}'>{$cat4value}</a></li>\n"; $l3++; } if($l3>0){ $sitemapout.= " </ul><!--// third //-->\n"; } $sitemapout.= " </ul><!--// first //-->\n </li>\n"; // end loop } echo "<ul>"; echo $sitemapout; echo "</ul>"; ?> -
I am creating a dynamic human readable sitemap from mysql>php. the array is created with; (array structure can be altered if this is causing the grief) <?php $row['category'] = varchar; // list of 10 categories $row['status'] = int; // 0,1 or 2 $row['id'] = int; // 1,2,3,4... (AI) // set the title for link $this->sitemap[$row['category']][$row['status']]['title'][$row['id']] = $row['seo_title']; // set the url for link $this->sitemap[$row['category']][$row['status']]['url'][$row['id']] = $row['slug'].".php"; ?> My required output to be as; <ul> <li>category[0] <ul> // all category[0][2] <li><a href="category[0][2]['title']['the row id']">category[0][2]['title']['the row id']</a></li> etc... // all category[0][1] <ul> <li><a href="category[0][1]['title']['the row id']">category[0][1]['title']['the row id']</a></li> etc.... // all category[0][0] <ul> <li><a href="category[0][0]['title']['the row id']">category[0][0]['title']['the row id']</a></li> </ul> </ul> <li>category[1] <ul> // all category[1][2] <li><a href="category[1][2]['title']['the row id']">category[1][2]['title']['the row id']</a></li> etc... keep in mind where caetgory[0] is a string as key, not an integer. Any ideas or questions welcomed, thanks.
-
Hi, I am looking to redirect URLS from: mypage.php?id1=this&id2=that&id3=&id4=&id5=&id6=&id7=last to mypage--id7-id1-id2 id1 alphanumeric, id2 numeric id7 (may have special chars (- + &)) this is what I have tried Options +FollowSymlinks RewriteEngine on RewriteRule ^mypage-([^\n]+)--([0-9a-z]+)-([0-9]+)$ /mypage.php?id1=$2&id2=$3&id3=&id4=&id5=&id6=&id7=$1 [NC] RewriteRule ^mypage\.php\?id1=([0-9A-Za-z]+)&id2=([0-9]+)&id3=&id4=&id5=&id6=&id7=([^\n]*)$ mypage-$3--$1-$2 [R=301,NC,L] It handles 1 part fine, mypage--id7-id1-id2 is read as mypage.php?id1=this&id2=that&id3=&id4=&id5=&id6=&id7=last I just want it to redirect the old non SEO url then read as this is updating a site with a couple thousand pages already linked on the net. Ideas welcomed.
-
htaaccess, ANYONE will know this! i just suck please help...
ozestretch replied to luke777's topic in Apache HTTP Server
i'm no expert, but shall offer an eye. i am pretty sure only need to register engine base etc once. also %1 should be $1 ? Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^mysite.com[NC] RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301] # rewriteCond %{HTTP_HOST} ([^.]+)\.mysite.com [NC] rewriteCond %{HTTP_HOST} !^www\.mysite\.com rewriteRule ^$ /turf/grabpage.php?page=$1 # RewriteRule ^files/([^/]+)/([^/]+) /turf/grabpage.php?page=$1&file=$2 [NC] -
This is a lead on of a previous question (which was solved but may have caused this issue) This is how I want it to operate. domain.com, domain.com/xxxx to have trailing slashes domain.com/xxxx+, domain.com/xxxx+all to not have trailing slashes www.domain.com redirect without www sub.domain.com to not inherit any rules if possible - currently redirects to actual subfolder domain.com/sub/ domain.com/anyfilename.php to be domain.com/anyfilename/ (go.php checks to see if database record, if not it checks for actual file/folder) <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteCond %{REQUEST_URI} ([^+])$ RewriteCond %{REQUEST_URI} !([a-zA-Z0-9]\+(all))$ RewriteRule (.*)$ http\:\/\/domain\.com\/$1\/ [QSA,R,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} !^domain\.com$ [NC] RewriteRule ^(.*)$ http\:\/\/domain\.com\/$1 [QSA,L,R] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([0-9A-Za-z]+)/?$ /go.php?id=$1 [QSA,L] RewriteRule ^([0-9A-Za-z]+)\+/?$ /info.php?id=$1 [L] RewriteRule ^([0-9A-Za-z]+)\+all/?$ /info.php?id=$1&all=1 [L] </IfModule> it all 'seems' to do as I want, except the subdomain issue
-
(htaccess) remove trailing slash when + present in url
ozestretch replied to ozestretch's topic in Apache HTTP Server
Sorted - thnks corz RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteCond %{REQUEST_URI} ([^+])$ RewriteCond %{REQUEST_URI} !([a-zA-Z0-9]\+(all))$ RewriteRule (.*)$ http://domain.com$1/ [QSA,R=301,L] # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1/ [QSA,L,R=301] -
(htaccess) remove trailing slash when + present in url
ozestretch replied to ozestretch's topic in Apache HTTP Server
thanks, unfortunately it doesn't offer what I need. domain.com domain.com/xxxxx to have trailing slash domain.com/xxxxx+ and domain.com/xxxxx+all to have no trailing slash so far it works except the trailing slash is still added to domain.com/xxxxx+all RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteCond %{REQUEST_URI} ([^+])$ RewriteRule (.*)$ http://domain.com/$1/ [QSA,R=301,L] # RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} !^domain.com$ [NC] RewriteRule ^(.*)$ http://domain.com/$1/ [QSA,L,R=301] -
(htaccess) remove trailing slash when + present in url
ozestretch replied to ozestretch's topic in Apache HTTP Server
okay so this isn't what I needed either RewriteCond %{REQUEST_URI} ([^+-+all])$ this is good as the only links with a + are desired to not have trailing slash RewriteCond %{REQUEST_URI} ([^+])$ but the first method means if there is an a or an l it no work... help x 2 now lol thanks -
Currently I add trailing slash to all directories so domain.com/666 redirs to domain.com/666/ I have a function that looks for '+' domain.com/666+ or domain.com/666+all but I do not want these urls to add a trailing slash So that works fine.... Issues is if a trailing slash is added (by user or whatever) at the end of a link like domain.com/666+/ domain.com/666+all/ I want it removed. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteCond %{REQUEST_URI} ([^+-+all])$ RewriteRule (.*)$ http://domain.com/$1/ [R=301,L] I would post what I tried but I kept deleting and starting over.
-
have you printed the query itself? if so, have you ran that query directly into the database? phpmyadmin etc..
-
Sorry for delay. // assuming the ONLY thing in the query string is the ID $URL = $_SERVER['QUERY_STRING']; // changed, missing ';' while($line = mysql_fetch_assoc($results)) { if (in_array($URL,$line["ID"])) // changed from ['QUERY_STRING'] to $URL echo "<item>" . $line["Email"] . "</item>\n"; }
-
$_SERVER['QUERY_STRING']
-
I was given an Ubuntu, like 4 years ago... never ended up using it though. Will give it a try during the week.