svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Main.php www/config.sample.php www/index.php www/sample.htaccess
www/templates/Categories.tpl.php www/templates/PackageList.tpl.php
| From: | Brett Bieber | Date: | Fri, 04 Dec 2009 19:48:02 +0000 |
| Subject: | svn: /pear2/sandbox/SimpleChannelFrontend/trunk/ src/SimpleChannelFrontend/Main.php www/config.sample.php www/index.php www/sample.htaccess www/templates/Categories.tpl.php www/templates/PackageList.tpl.php |
||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9072@lists.php.net to get a copy of this message | ||
saltybeagle Fri, 04 Dec 2009 19:48:02 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=291713
Log:
Change package urls to be channel/PackageName for consistency with pear/pyrus cli usage, add sample
.htaccess for how to set this up.
Changed paths:
U pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
U pear2/sandbox/SimpleChannelFrontend/trunk/www/config.sample.php
U pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php
A pear2/sandbox/SimpleChannelFrontend/trunk/www/sample.htaccess
U pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php
U pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php 2009-12-04 19:47:57
UTC (rev 291712)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/src/SimpleChannelFrontend/Main.php 2009-12-04 19:48:02
UTC (rev 291713)
@@ -43,6 +43,8 @@
'package' =>
'pear2\SimpleChannelFrontend\Package',
'categories' =>
'pear2\SimpleChannelFrontend\Categories');
+ public static $url = '';
+
/**
* Constructor
*
@@ -125,7 +127,7 @@
*/
public static function getURL($class = null)
{
- $url = '';
+ $url = static::$url;
if ($class) {
if (is_object($class)) {
$class = get_class($class);
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/config.sample.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/config.sample.php 2009-12-04 19:47:57 UTC (rev
291712)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/config.sample.php 2009-12-04 19:48:02 UTC (rev
291713)
@@ -23,3 +23,5 @@
* An example of setting up the channel object.
*/
$channel = new \pear2\Pyrus\ChannelFile(__DIR__ . '/channel.xml');
+
+pear2\SimpleChannelFrontend\Main::$url = 'http://channel.com/';
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php 2009-12-04 19:47:57 UTC (rev 291712)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/index.php 2009-12-04 19:48:02 UTC (rev 291713)
@@ -1,8 +1,16 @@
<?php
require_once 'config.inc.php';
-$frontend = new pear2\SimpleChannelFrontend\Main($channel, $_GET);
+$options = $_GET;
+if (isset($_SERVER['REDIRECT_URL'])) {
+ $options['view'] = 'package';
+ $options['package'] = substr($_SERVER['REDIRECT_URL'],
+ strrpos($_SERVER['REDIRECT_URL'], '/'));
+}
+
+$frontend = new pear2\SimpleChannelFrontend\Main($channel, $options);
+
$savant = new pear2\Templates\Savant\Main();
$savant->setClassToTemplateMapper(new pear2\SimpleChannelFrontend\TemplateMapper);
$savant->setTemplatePath(array(__DIR__ . '/templates'));
Added: pear2/sandbox/SimpleChannelFrontend/trunk/www/sample.htaccess
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/sample.htaccess (rev 0)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/sample.htaccess 2009-12-04 19:48:02 UTC (rev
291713)
@@ -0,0 +1,7 @@
+<IfModule mod_rewrite.c>
+RewriteEngine On
+RewriteBase /
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule . index.php [L]
+</IfModule>
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php 2009-12-04 19:47:57
UTC (rev 291712)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/Categories.tpl.php 2009-12-04 19:48:02
UTC (rev 291713)
@@ -16,7 +16,7 @@
if (count($category)) {
echo '<ul>';
foreach ($category as $package) {
- echo '<li><a
href="./?view=package&package='.$package->name.'">'.$package->name.'</a></li>';
+ echo '<li><a
href="'.pear2\SimpleChannelFrontend\Main::getURL().$package->name.'">'.$package->name.'</a></li>';
}
echo '</ul>';
}
Modified: pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php
===================================================================
--- pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php 2009-12-04 19:47:57
UTC (rev 291712)
+++ pear2/sandbox/SimpleChannelFrontend/trunk/www/templates/PackageList.tpl.php 2009-12-04 19:48:02
UTC (rev 291713)
@@ -7,7 +7,7 @@
<ul>
<?php
foreach ($context as $package) {
- echo '<li><a
href="./?view=package&package='.$package->name.'">'.$package->name.'</a></li>';
+ echo '<li><a
href="'.pear2\SimpleChannelFrontend\Main::getURL().$package->name.'">'.$package->name.'</a></li>';
}
?>
</ul>