Re: Use friendly aliases, ’off’
I would like modx to use the prefix, and suffix specified on the configuration page together with the page id to form the alias... unless I override the alias by specifying one for the page: I know it’s just aesthetic, but I don’t want all my pages to have the same suffix. They are not all html. This is what I understood what would happen if I chose friendly aliases ’off’ from the explanation on the friendly urls configuration tab, but it’s not entirely clear. Have I got it right, because it doesn’t appear to work? Even with friendly aliases off, it always uses the ’prefix id suffix’ combination.
Re: Google ads and $_GET[’q’].
After making the post last night, I figured out a solution using bits and pieces I read in forums that lets me include google ads in a (XHTML) modx page. First I modify the GET parameter used by the google search box, changing the
<input type="text" name="q" ...
for
<input type="text" name="mdxq" ...
(Don’t worry, it’s changed back before the search is submitted.) I direct the search to the modx page I want the ads on. Since the google query string doesn’t contain q=, this goes to the correct modx page. Next, I take the google search results code and put it into an html document that is on the server, but not managed by modx.
So, GoogleSearch.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" >
<head>
<title>Google Search Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<style type="text/css">
body { margin: 0; padding: 0; }
</style>
</head>
<body>
<!-- Google Search Result Snippet Begins -->
<div id="googleSearchUnitIframe"></div>
<script type="text/javascript">
var googleSearchIframeName = 'googleSearchUnitIframe';
var googleSearchFrameWidth = 500;
var googleSearchFrameborder = 0 ;
var googleSearchDomain = 'www.google.co.uk';
</script>
<script type="text/javascript"
src="http://www.google.com/afsonline/show_afs_search.js">
</script>
<!-- Google Search Result Snippet Ends -->
</body>
Next I include the ads in my modx results page document, by writing a little snippet which takes the query string sent to the modx page, changes the mdxq GET parameter back to a q, and includes the GoogleSearch.html file with the correct parameters using <object>:
<?php
echo '<object data=".../GoogleSearch.html' . '?' . str_replace('mdxq=','q=',$_SERVER['QUERY_STRING']) . '" type="text/html" width="..." height="..." ></object>';
?>
Then the search results appear wherever I place the snippet. Hey presto; Google ads on a modx page with no modx code hacks, and can be done in a completely standard conforming way. I hope that’s useful to other people out there.
Paul