Textpattern CMS support forum

You are not logged in. Register | Login | Help

#51 2009-06-05 09:02:23

Gallex
Member
Registered: 2006-10-08
Posts: 934

Re: rah_sitemap

damienbuckley wrote:

found 3 places…
Me too – seems to be working ok now.

i got parser error ;)

Offline

#52 2009-06-06 00:44:46

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: rah_sitemap

Gallex wrote:

damienbuckley wrote:

found 3 places…
Me too – seems to be working ok now.

i got parser error ;)

I used a find/replace the first time round and got the parser error so I did it manually and it worked fine:- here’s my code

	##################
	#
	#	rah_sitemap-plugin for Textpattern
	#	version 0.4
	#	by Jukka Svahn
	#	http://rahforum.biz
	#
	###################

	if (@txpinterface == 'admin') {
		add_privs('rah_sitemap', '1,2');
		register_tab("extensions", "rah_sitemap", "Sitemap");
		register_callback("rah_sitemap_page", "rah_sitemap");
	} else if(gps('rah_sitemap') == 'sitemap') rah_sitemap();

	function rah_sitemap() {
		header('Content-type: application/xml');
		if(function_exists('gzencode')) header("Content-Encoding: gzip");
		global $s, $thissection, $thiscategory, $c, $pretext, $thispage, $thisarticle;
		$out = array();
		$out[] = 
			'<?xml version="1.0" encoding="utf-8"?>'.
			'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'.
			'<url><loc>'.hu.'</loc></url>';

		// Sections

		if(@fetch('value','rah_sitemap_prefs','name','nosections') != 1) {
			$not = trim(fetch('value','rah_sitemap_prefs','name','sections'));
			$not = ($not) ? $not.',default' : 'default';
			$not = ($not) ? explode(',',$not) : array();
			$exclude = array();
			foreach ($not as $key => $value) {
				$exclude[$key] = "'".doSlash($value)."'";
			}
			$not = implode(',',$exclude);
			$permlink_section = trim(fetch('value','rah_sitemap_prefs','name','permlink_section'));
			$rs = safe_rows_start('name,title','txp_section',"name not in($not) order by name asc");

			while ($a = nextRow($rs)) {
				extract($a);
				$pretext['s'] = $name;
				$thispage['s'] = $name;
				$thissection['section'] = $name;
				$s = $name;
				$thisarticle['section'] = '';

				$out[] = '<url><loc>'.
					(
						($permlink_section) ? 
							trim(strip_tags(parse($permlink_section)))
						: 
							pagelinkurl(array('s' => $name))
					).
					'</loc></url>'
				;
				$pretext['s'] = '';
				$thispage['s'] = '';
				$thissection['section'] = '';
				$s = '';
			}
		}

		// Categories: rebuilt

		$notypes = array();
		if(@fetch('value','rah_sitemap_prefs','name','nocategories') == 1) $notypes[] = 'article';
		if(@fetch('value','rah_sitemap_prefs','name','nofile') == 1) $notypes[] = 'file';
		if(@fetch('value','rah_sitemap_prefs','name','noimage') == 1) $notypes[] = 'image';
		if(@fetch('value','rah_sitemap_prefs','name','nolink') == 1) $notypes[] = 'link';

		$not = trim(fetch('value','rah_sitemap_prefs','name','categories'));
		$not = ($not) ? $not.',root' : 'root';
		$not = ($not) ? explode(',',$not) : array();
		$permlink_category = trim(fetch('value','rah_sitemap_prefs','name','permlink_category'));
		$rs = safe_rows_start('name,type,id','txp_category',"name != 'root' order by name asc");
		while ($a = nextRow($rs)) {
			extract($a);
			if(in_array($type,$notypes)) continue;
			if(in_array($type.'_||_'.$name,$not)) continue;
			$pretext['c'] = $name;
			$thispage['c'] = $name;
			$thiscategory['c'] = $name;
			$c = $name;
			$out[] = '<url><loc>'.
				(
					($permlink_category) ? 
						str_replace(
							array(
								'[type]',
								'[id]'
							),
							array(
								$type,
								$id
							),
							trim(strip_tags(parse($permlink_category)))
						)
					: 
						pagelinkurl(array('c' => $name))
				).
				'</loc></url>'
			;
			$pretext['c'] = '';
			$thispage['c'] = '';
			$thiscategory['c'] = '';
			$c = '';
		}

		// Articles

		if(@fetch('value','rah_sitemap_prefs','name','noarticles') != 1) {
			$not = trim(fetch('value','rah_sitemap_prefs','name','articlecategories'));
			$not = ($not) ? $not.',root' : 'root';
			$not = ($not) ? explode(',',$not) : array();
			$exclude = array();
			foreach ($not as $key => $value) {
				$exclude[$key] = "'".doSlash($value)."'";
			}
			$notcategory = implode(',',$exclude);
			$not = trim(fetch('value','rah_sitemap_prefs','name','articlesections'));
			$not = ($not) ? $not.',default' : 'default';
			$not = ($not) ? explode(',',$not) : array();
			$exclude = array();
			foreach ($not as $key => $value) {
				$exclude[$key] = "'".doSlash($value)."'";
			}
			$notsection = implode(',',$exclude);
			$notstatus = trim(fetch('value','rah_sitemap_prefs','name','articlestatus'));
			$notstatus = '1,2,3'.(($notstatus) ? ','.$notstatus : '');
			$permlink_article = trim(fetch('value','rah_sitemap_prefs','name','permlink_article'));
			$rs = 
				safe_rows_start(
					(
						($permlink_article) ? 
							'*,  unix_timestamp(Posted) as uPosted, unix_timestamp(Expires) as uExpires, unix_timestamp(LastMod) as uLastMod'
						: 
							'ID, Posted, LastMod'
					),
					'textpattern',
					"Category1 not in($notcategory) and ".
					"Category2 not in($notcategory) and ".
					"Section not in($notsection) and ".
					((fetch('value','rah_sitemap_prefs','name','articlefuture')) ? 
						"Posted <= now() and " : ''
					).
					((fetch('value','rah_sitemap_prefs','name','articlepast')) ? 
						"Posted > now() and " : ''
					).
					((fetch('value','rah_sitemap_prefs','name','articleexpired')) ? 
						"(Expires = '0000-00-00 00:00:00' or Expires >= now()) and " : ''
					).
					"Status not in($notstatus) ".
					"order by Posted desc"
				);
			while ($a = nextRow($rs)) {
				extract($a);
				if($permlink_article) {
					$thisarticle = 
						array(
							'thisid' => $ID,
							'posted' => $uPosted,
							'modified' => $uLastMod,
							'annotate' => $Annotate,
							'comments_invite' => $AnnotateInvite,
							'authorid' => $AuthorID,
							'title' => $Title,
							'url_title' => $url_title,
							'category1' => $Category1,
							'category2' => $Category2,
							'section' => $Section,
							'keywords' => $Keywords,
							'article_image' => $Image,
							'comments_count' => $comments_count,
							'body' => $Body_html,
							'excerpt' => $Excerpt_html,
							'override_form' => $override_form,
							'status'=> $Status
						)
					;
				}
				$out[] = '<url><loc>'.
					(
						($permlink_article) ? 
							trim(strip_tags(parse($permlink_article)))
						: 
							permlinkurl_id($ID)
					).
					'</loc><lastmod>'.
					(
						($LastMod < $Posted) ? 
							date('Y-m-d\TH:i:s+00:00',strtotime($Posted)) : 
							date('Y-m-d\TH:i:s+00:00',strtotime($LastMod))
					).
					'</lastmod></url>'
				;
				$thisarticle = '';
			}
		}

		// Custom URLs

		$rs = safe_rows_start('*','rah_sitemap',"1=1 order by posted desc");
		while ($a = nextRow($rs)) {
			extract($a);
			$url = parse($url);
			$out[] = '<url><loc>'.((substr($url,0,4) != 'http') ? hu : '').$url.'</loc>'.(($include == 1) ? '<lastmod>'.date('Y-m-d\TH:i:s+00:00',strtotime($posted)).'</lastmod>' : '').'</url>';
		}
		$out[] = '</urlset>';
		$out = implode('',$out);
		echo (function_exists('gzencode')) ? gzencode($out,9) : $out;
		exit();
	}

	function rah_sitemap_page() {
		global $step;
		require_privs('rah_sitemap');
		rah_sitemap_install();
		if(in_array($step,array(
			'rah_sitemap_save',
			'rah_sitemap_custom_form',
			'rah_sitemap_custom',
			'rah_sitemap_delete'
		))) $step();
		else rah_sitemap_list();
	}

	function rah_sitemap_list($message='') {
		pagetop('rah_sitemap',$message);


		echo 
			n.'	<form method="post" action="index.php" style="width:900px;margin:0 auto;position:relative;">'.n.
			'		<h1><strong>rah_sitemap</strong> | Manage your sitemap</h1>'.n.
			'		<input type="submit" value="'.gTxt('save').'" class="publish" style="position:absolute;top:5px;right:30px;" />'.n.
			'		<p>'.
			'» <a href="?event=rah_sitemap&amp;step=rah_sitemap_custom_form">Add custom URLs</a> '.
			'» <a target="_blank" href="'.hu.'?rah_sitemap=sitemap">View sitemap</a>'.
			'</p>'.n.
			'		<fieldset style="padding:20px;margin:20px 0;">'.n.
			'			<legend>Section and category URL settings</legend>'.n.
			'			<table border="0" cellspacing="0" cellpadding="0" style="width:100%">'.n.
			'				<tr>'.n.
			rah_sitemap_listing('Exclude sections','sections','txp_section',"name != 'default'").
			rah_sitemap_listing('Exclude categories','categories','txp_category',"name != 'root' and title != 'root'").
			'					<td>'.n.
			'						<h3>Advanced settings</h3>'.n.
			'						<ul style="list-style:none;margin:0;padding:0;">'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="nosections" value="1"'.((fetch('value','rah_sitemap_prefs','name','nosections') == 1) ? ' checked="checked"' : '').' /> Exclude all section URLs</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="nofile" value="1"'.((fetch('value','rah_sitemap_prefs','name','nofile') == 1) ? ' checked="checked"' : '').' /> Exclude all file-type category URLs</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="noimage" value="1"'.((fetch('value','rah_sitemap_prefs','name','noimage') == 1) ? ' checked="checked"' : '').' /> Exclude all image-type category URLs</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="nolink" value="1"'.((fetch('value','rah_sitemap_prefs','name','nolink') == 1) ? ' checked="checked"' : '').' /> Exclude all link-type category URLs</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="nocategories" value="1"'.((fetch('value','rah_sitemap_prefs','name','nocategories') == 1) ? ' checked="checked"' : '').' /> Exclude all article-type category URLs</label></li>'.n.
			'						</ul>'.n.
			'					</td>'.n.
			'				</tr>'.n.
			'			</table>'.n.
			'		</fieldset>'.n.
			'		<fieldset style="padding:20px;margin:20px 0;">'.n.
			'			<legend>Article URL settings</legend>'.n.
			'			<table border="0" cellspacing="0" cellpadding="0" style="width:100%">'.n.
			'				<tr>'.n.
			rah_sitemap_listing('Exclude article sections','articlesections','txp_section',"name != 'default'").
			rah_sitemap_listing('Exclude article categories','articlecategories','txp_category',"name != 'root' and title != 'root' and type = 'article'").
			'					<td>'.n.
			'						<h3>Advanced settings</h3>'.n.
			'						<ul style="list-style:none;margin:0;padding:0;">'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="noarticles" value="1"'.((fetch('value','rah_sitemap_prefs','name','noarticles') == 1) ? ' checked="checked"' : '').' /> Don\'t include articles in sitemap</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="articlestatus" value="5"'.((fetch('value','rah_sitemap_prefs','name','articlestatus') == 5) ? ' checked="checked"' : '').' /> Exclude sticky articles</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="articlefuture" value="1"'.((fetch('value','rah_sitemap_prefs','name','articlefuture') == 1) ? ' checked="checked"' : '').' /> Exclude future articles</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="articlepast" value="1"'.((fetch('value','rah_sitemap_prefs','name','articlepast') == 1) ? ' checked="checked"' : '').' /> Exclude past articles</label></li>'.n.
			'							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="articleexpired" value="1"'.((fetch('value','rah_sitemap_prefs','name','articleexpired') == 1) ? ' checked="checked"' : '').' /> Exclude expired articles</label></li>'.n.
			'						</ul>'.n.
			'					</td>'.n.
			'				</tr>'.n.
			'			</table>'.n.
			'		</fieldset>'.n.
			'		<fieldset style="padding:20px;margin:20px 0;">'.n.
			'			<legend>Permlink settings</legend>'.n.
			'			<p>With these settings you can make the Sitemap\'s URLs to match your own URL rewriting rules, or permlinks made by a <em>custom permlink rule</em> plugin. You can leave these fields empty, if using TXP\'s inbuild permlink rules. Note that these setting do not rewrite TXP\'s permlinks for you, use only for matching not rewriting!</p>'.n.
			'			<table border="0" cellspacing="0" cellpadding="0" style="width:100%">'.n.
			'				<tr>'.n.
			'					<td><label for="rah_sitemap_permlink_category">Category URLs:</label></td>'.n.
			'					<td><label for="rah_sitemap_permlink_section">Section URLs:</label></td>'.n.
			'					<td><label for="rah_sitemap_permlink_article">Article URLs:</label></td>'.n.
			'				</tr>'.n.
			'				<tr>'.n.
			'					<td>'.n.
			'						<input type="text" class="edit" size="40" name="permlink_category" id="rah_sitemap_permlink_category" value="'.htmlspecialchars(fetch('value','rah_sitemap_prefs','name','permlink_category')).'" />'.n.
			'					</td>'.n.
			'					<td>'.n.
			'						<input type="text" class="edit" size="40" name="permlink_section" id="rah_sitemap_permlink_section" value="'.htmlspecialchars(fetch('value','rah_sitemap_prefs','name','permlink_section')).'" />'.n.
			'					</td>'.n.
			'					<td>'.n.
			'						<input type="text" class="edit" size="40" name="permlink_article" id="rah_sitemap_permlink_article" value="'.htmlspecialchars(fetch('value','rah_sitemap_prefs','name','permlink_article')).'" />'.n.
			'					</td>'.n.
			'			</table>'.n.
			'		</fieldset>'.n.
			'		<input type="hidden" name="event" value="rah_sitemap" />'.n.
			'		<input type="hidden" name="step" value="rah_sitemap_save" />'.n.
			'	</form>'.n;
	}

	function rah_sitemap_custom_form($message='') {
		pagetop('rah_sitemap',$message);
		if(gps('edit')) {
			$edit = base64_decode(gps('edit'));
			$edit = doSlash($edit);
		} else $edit = '';
		echo 
			n.'	<form method="post" action="index.php" style="width:900px;margin:0 auto;">'.n.
			'		<h1><strong>rah_sitemap</strong> | Manage custom URLs</h1>'.n.
			//'		<input type="submit" value="'.gTxt('save').'" class="publish" style="position:absolute;top:5px;right:30px;" />'.n.
			'		<p>'.
			'» <a href="?event=rah_sitemap">Sitemap preferences</a> '.
			'» <a target="_blank" href="'.hu.'?rah_sitemap=sitemap">View sitemap</a>'.
			'</p>'.n.
			'		<fieldset style="padding:20px;margin:20px 0;">'.n.
			'			<legend>'.((gps('edit') && safe_count('rah_sitemap',"url='$edit'") > 0) ? 'Copy/replace custom URL' : 'Add custom URL').'</legend>'.n.
			'			<table border="0" cellspacing="0" cellpadding="2" style="width:100%;">'.n.
			'				<tr>'.n.
			'					<td><label for="rah_sitemap_url">URL:</label></td>'.n.
			'					<td><input id="rah_sitemap_url" class="edit" type="text" name="url" value="'.htmlspecialchars($edit).'" size="80" /></td>'.n.
			'				</tr>'.n.
			(
				(gps('edit') && safe_count('rah_sitemap',"url='$edit'") > 0) ?
					'				<tr>'.n.
					'					<td><label for="rah_sitemap_reset">Reset LastMod</label></td>'.n.
					'					<td><input id="rah_sitemap_reset" name="reset" type="checkbox" value="1" checked="checked" /></td>'.n.
					'				</tr>'.n
				:
					''
			).
			'				<tr>'.n.
			'					<td><label for="rah_sitemap_lastmod">Include LastMod</label></td>'.n.
			'					<td>'.n.
			'						<select id="rah_sitemap_lastmod" name="include">'.n.
			'							<option value="0"'.(($edit && fetch('include','rah_sitemap','url',$edit) == 0) ? ' selected="selected"' : '').'>'.gTxt('no').' (Recommended)</option>'.n.
			'							<option value="1"'.(($edit && fetch('include','rah_sitemap','url',$edit) == 1) ? ' selected="selected"' : '').'>'.gTxt('yes').'</option>'.n.
			'						</select>'.n.
			'					</td>'.n.
			'				</tr>'.n.
			'				<tr>'.n.
			'					<td colspan="2" style="text-align: right;"><input type="submit" value="'.gTxt('save').'" class="publish" /></td>'.n.
			'				</tr>'.n.
			'			</table>'.n.

			'		</fieldset>'.n.
			'		<input type="hidden" name="event" value="rah_sitemap" />'.n.
			'		<input type="hidden" name="step" value="rah_sitemap_custom" />'.n.
			//'		<h2>Custom sitemap URLs</h2>'.n.
			'	</form>'.n.
			'	<form method="post" action="index.php" style="width:900px;margin:0 auto;" onsubmit="return confirm(\'Are you sure?\');">'.n.
			'		<table id="list" class="list" style="width:100%;" border="0" cellspacing="0" cellpadding="0">'.n.
			'			<tr>'.n.
			'				<th>URL</th>'.n.
			'				<th>LastMod</th>'.n.
			'				<th>Include LastMod</th>'.n.
			'				<th>'.gTxt('view').'</th>'.n.
			'				<th> </th>'.n.
			'			</tr>'.n;

		$rs = safe_rows_start('url,posted,include','rah_sitemap',"1=1 order by posted desc");
		if ($rs and numRows($rs) > 0){
			while ($a = nextRow($rs)) {
				extract($a);
				echo 
					'			<tr>'.n.
					'				<td><a href="?event=rah_sitemap&amp;step=rah_sitemap_custom_form&amp;edit='.base64_encode($url).'">'.$url.'</a></td>'.n.
					'				<td>'.$posted.'</td>'.n.
					'				<td>'.(($include == 1) ? gTxt('yes') : gTxt('no')).'</td>'.n.
					'				<td><a target="_blank" href="'.((substr($url,0,4) != 'http') ? hu : '').$url.'">'.gTxt('view').'</a></td>'.n.
					'				<td><input type="checkbox" name="rah_name[]" value="'.base64_encode($url).'" /></td>'.n.
					'			</tr>'.n;
			}
		} else echo '			<tr><td colspan="5">No custom URLs found.</td></tr>'.n;
		echo 
			'		</table>'.n.
			'		<p style="text-align: right;padding-top:10px;">'.n.
			'			<label for="rah_sitemap_step">With selected:</label>'.n.
			'			<select name="step" id="rah_sitemap_step">'.n.
			'				<option value="">Select...</option>'.n.
			'				<option value="rah_sitemap_delete">Delete</option>'.n.
			'			</select>'.n.
			'			<input type="submit" class="smallerbox" value="Go" />'.n.
			'		</p>'.n.
			'		<input type="hidden" name="event" value="rah_sitemap" />'.n.
			'	</form>'.n;
	}

	function rah_sitemap_install() {
		safe_query("CREATE TABLE IF NOT EXISTS ".safe_pfx('rah_sitemap')." (`url` VARCHAR(255) NOT NULL, `posted` DATETIME NOT NULL, `include` INT(1) NOT NULL, PRIMARY KEY(`url`))");
		safe_query("CREATE TABLE IF NOT EXISTS ".safe_pfx('rah_sitemap_prefs')." (`name` VARCHAR(255) NOT NULL DEFAULT '', `value` LONGTEXT NOT NULL DEFAULT '', PRIMARY KEY(`name`))");
		$values = array('noarticles','nosections','nocategories','articlecategories','articlesections','sections','categories','nofile','noimage','nolink','articlestatus','articlefuture','articlepast','articleexpired','permlink_category','permlink_section','permlink_article');
		$count = count($values);
		$i = 0;
		while($i<$count) {
			if(safe_count('rah_sitemap_prefs',"name='".$values[$i]."'") == 0) safe_insert('rah_sitemap_prefs',"name='".$values[$i]."', value=''");
			$i++;
		}
	}

	function rah_sitemap_custom() {
		extract(doSlash(gpsa(array('url','include'))));
		if(safe_count('rah_sitemap',"url='$url'") == 0) {
			safe_insert(
				'rah_sitemap',
				"url='$url',posted=now(),include='$include'"
			);
			rah_sitemap_custom_form('URL <strong>'.htmlspecialchars(ps('url')).'</strong> updated');
		} else {
			if(ps('reset') == 1) 
				safe_update(
					'rah_sitemap',
					"posted=now(),include='$include'",
					"url='$url'"
				);
			else safe_update(
				'rah_sitemap',
				"include='$include'",
				"url='$url'"
			);
			rah_sitemap_custom_form('URL <strong>'.htmlspecialchars(ps('url')).'</strong> created');
		}
	}

	function rah_sitemap_listing($label='',$field='',$table='',$where='') {
		$exclude = explode(',',fetch('value','rah_sitemap_prefs','name',$field));
		$rs = safe_rows_start('name,title'.(($table == 'txp_category') ? ',type' : ''),$table,"$where order by ".(($table == 'txp_category') ? 'type asc, ' : '')." name asc");
		$out[] = 
			'					<td>'.n.
			'						<h3>'.$label.'</h3>'.n.
			'						<ul style="list-style:none;margin:0;padding:0;">'.n;

		if ($rs and numRows($rs) > 0){
			while ($a = nextRow($rs)) {
				extract($a);
				$out[] = '							<li style="padding:3px 0;margin:0;"><label><input type="checkbox" name="'.$field.'[]" value="'.(($field == 'categories') ? $type.'_||_' : '').$name.'"'.((in_array((($field == 'categories') ? $type.'_||_' : '').$name,$exclude)) ? ' checked="checked"' : '').' /> '.(($field == 'categories') ? ucfirst($type).': ' : '').$title.'</label></li>'.n;
			}
		} else $out[] = '							<li style="padding:3px 0;margin:0;">Nothing found.</li>'.n;
		$out[] = 
			'						</ul>'.n.
			'					</td>'.n;
		return implode('',$out);
	}

	function rah_sitemap_save() {
		rah_sitemap_update(ps('noarticles'),'noarticles');
		rah_sitemap_update(ps('nosections'),'nosections');
		rah_sitemap_update(ps('nocategories'),'nocategories');
		rah_sitemap_update(ps('articlecategories'),'articlecategories');
		rah_sitemap_update(ps('articlesections'),'articlesections');
		rah_sitemap_update(ps('sections'),'sections');
		rah_sitemap_update(ps('categories'),'categories');
		rah_sitemap_update(ps('nofile'),'nofile');
		rah_sitemap_update(ps('noimage'),'noimage');
		rah_sitemap_update(ps('nolink'),'nolink');
		rah_sitemap_update(ps('articlestatus'),'articlestatus');
		rah_sitemap_update(ps('articlefuture'),'articlefuture');
		rah_sitemap_update(ps('articlepast'),'articlepast');
		rah_sitemap_update(ps('articleexpired'),'articleexpired');
		rah_sitemap_update(ps('permlink_article'),'permlink_article');
		rah_sitemap_update(ps('permlink_category'),'permlink_category');
		rah_sitemap_update(ps('permlink_section'),'permlink_section');
		rah_sitemap_list('Sitemap preferences saved');
	}

	function rah_sitemap_delete() {
		$selected = ps('rah_name');
		if(!is_array($selected)) $selected = explode(',',$selected);
		$i = 0;
		foreach($selected as $name) {
			$name = base64_decode($name);
			safe_delete('rah_sitemap',"url='".doSlash($name)."'");
			$i++;
		}
		rah_sitemap_custom_form($i.' deleted.');
	}

	function rah_sitemap_update($array='',$column='') {
		$val = (is_array($array)) ? doSlash(implode(',',$array)) : doSlash($array);
		safe_update('rah_sitemap_prefs',"value='$val'","name='$column'");
	}

Offline

#53 2009-08-05 07:49:06

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: rah_sitemap

Thanks so much, i´m using the plugin with out problems at the moment.


Sonríe | Smile . <txp:lover />

Offline

#54 2010-02-22 16:55:57

mericson
Member
Registered: 2004-05-24
Posts: 127
Website

Re: rah_sitemap

Thanks for this plugin! I have a suggestion…

I was thinking it would be very nice if the logic were reversed, check sections/categories I want included rather than excluded.

If people want everything by default, just check them all by default and then people can uncheck the ones they want excluded.

The motivation for this is I don’t want new sections and categories automatically added because I didn’t exclude them. I’d rather go and check on them to include them when I’m ready.

Make sense?

If this doesn’t work for everyone, maybe a preference that switches between include and exclude logic?

Thanks again,

Mark

Offline

#55 2010-02-24 11:53:54

superfly
Plugin Author
From: vienna, austria
Registered: 2008-11-12
Posts: 23
Website

Re: rah_sitemap

I had trouble getting the Sitemap plugin running on PHP 5.3.1 / TXP 4.2. My Sitemap output looked this – http://bugs.php.net/bug.php?id=45202&edit=1
To get the sitemap running i added the following line before the “echo” at the end of the function rah_sitemap()

if (ini_get('zlib.output_compression'))
	ini_set('zlib.output_compression', 'Off');

I don’t know if it’s the Server or the PHP configuration which causes trouble, but maybe someone else might find this helpful…

Last edited by superfly (2010-02-24 15:49:11)


<code>is</poetry>

Offline

#56 2010-03-01 18:24:23

Gocom
Plugin Author
Registered: 2006-07-14
Posts: 4,524
Website

Re: rah_sitemap

Released version 0.5 of rah_sitemap. Changelog:

  • Added customizable timestamp formats. Now date() format can be changed from c value to something that your server supports.
  • Cleaned backend markup.
  • Compined individual preference queries.

More info and downloads

Offline

#57 2010-03-26 14:30:16

wornout
Member
From: Italy
Registered: 2009-01-20
Posts: 256
Website

Re: rah_sitemap

I am developing a multilingual site with MLP.
Rha_sitemap not generate the site map with the correct URL.
You can integrate the two plugins?
Thanks

Offline

#58 2010-03-26 18:06:43

Gocom
Plugin Author
Registered: 2006-07-14
Posts: 4,524
Website

Re: rah_sitemap

wornout wrote:

You can integrate the two plugins?

Permlink rules can be customized to match actual permlinks by using rah_sitemap’s URI settings which allow use of <txp:tags /> in URIs. Default permlinks will only support what TXP’s core supports.

Offline

#59 2010-03-26 22:36:33

Els
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,456

Re: rah_sitemap

Hi Jukka, I’ve got two questions:

which allow use of <txp:tags /> in URIs

Unfortunately it doesn’t seem to work with plugin tags (like <txp:l10n_get_lang />)?

Second, when experimenting with the above, I noticed that in the permlink settings for category URLs the <txp:section /> tag doesn’t output anything. When I enter <txp:site_url /><txp:section />/?c=<txp:category /> (yes, I know this is useless, but I was just testing) the output in the sitemap is http://www.site.com//?c=category-name. It works as expected though for section and article URLs.

Last edited by Els (2010-03-26 22:39:05)

Offline

#60 2010-03-26 23:03:32

Gocom
Plugin Author
Registered: 2006-07-14
Posts: 4,524
Website

Re: rah_sitemap

Els wrote:

Unfortunately it doesn’t seem to work with plugin tags

Depends how the plugins works and in which context.

<txp:section /> tag doesn’t output anything.

There is no section on the page, neither category can define in which section it belongs. Soooooooo it can’t ;-)

Offline

Board footer

Powered by FluxBB