Permalink
Browse files

More relative links.

  • Loading branch information...
1 parent a98415b commit c53fd17383f839db134b7647fe06bc6c075cf798 @ZetaTwo ZetaTwo committed Oct 10, 2012
Showing with 29 additions and 49 deletions.
  1. +12 −11 app/views/users/admin_list.ctp
  2. +17 −38 app/views/users/view.ctp
@@ -17,9 +17,10 @@ foreach($users as $key => $value) {
break;
}
?>
- <td><a href="/users/<?=$users[$key]['User']['public_key'];?>/<?=$users[$key]['User']['username'];?>"><?=$users[$key]['User']['username'];?></a>
+
+ <td><?=$html->link($users[$key]['User']['username'],'/users/' . $users[$key]['User']['public_key'] . '/' . $users[$key]['User']['username']);?>
<?if(empty($users[$key]['User']['permission'])) {?><a class="promote" href="/admin/promote/<?=$users[$key]['User']['public_key'];?>">promote</a><? } else { ?>
- <a class="demote" href="/admin/demote/<?=$users[$key]['User']['public_key'];?>">demote</a>
+ <?=$html->link(__('demote', true), '/admin/demote/' . $users[$key]['User']['public_key'], array('class' => 'demote'));?>
<? } ?>
</td>
<? $i++;
@@ -47,22 +48,22 @@ foreach($users as $key => $value) {
<?
if((($end_page - $current) > 3) && $current > 3) { ?>
- <span style="float: left;"><a href="/admin/users/1"><u>1</u>&nbsp;</a></span>
- <span style="float: left;"><a href="/admin/users/<?=$current-2;?>"><u><?=$current-2;?></u>&nbsp;</a></span>
- <span style="float: left;"><a href="/admin/users/<?=$current-1;?>"><u><?=$current-1;?></u>&nbsp;</a></span>
+ <span style="float: left;"><?=$html->link('<u>1</u>&nbsp;', '/admin/users/1', array('escape' => false)); ?></span>
+ <span style="float: left;"><?=$html->link('<u>' . $current-2 . '</u>&nbsp;', '/admin/users/' . $current-2, array('escape' => false)); ?></span>
+ <span style="float: left;"><?=$html->link('<u>' . $current-1 . '</u>&nbsp;', '/admin/users/' . $current-1, array('escape' => false)); ?></span>
<span style="float: left;"><?=$current;?>&nbsp;</span>
- <span style="float: left;"><a href="/admin/users/<?=$current+1;?>"><u><?=$current+1;?></u>&nbsp;</a></span>
- <span style="float: left;"><a href="/admin/users/<?=$current+2;?>"><u><?=$current+2;?></u>&nbsp;</a></span>
- <span style="float: left;"><a href="/admin/users/<?=$end_page;?>"><u><?=$end_page;?></u></a></span>
+ <span style="float: left;"><?=$html->link('<u>' . $current+1 . '</u>&nbsp;', '/admin/users/' . $current+1, array('escape' => false)); ?></span>
+ <span style="float: left;"><?=$html->link('<u>' . $current+2 . '</u>&nbsp;', '/admin/users/' . $current+2, array('escape' => false)); ?></span>
+ <span style="float: left;"><?=$html->link('<u>' . $end_page . '</u>&nbsp;', '/admin/users/' . $end_page, array('escape' => false)); ?></span>
<? }elseif($current < $end_page) { ?>
- <span style="float: left;">page <?=$current;?> of <a href="/admin/users/<?=$end_page;?>"><?=$end_page;?></a></span>
+ <span style="float: left;">page <?=$current;?> of <?=$html->link($end_page, '/admin/users/' . $end_page); ?></span>
<? }else { ?>
<span style="float: left;">page <?=$current;?> of <?=$end_page;?></span>
<? }
if(isset($next)) { ?>
- <span style="float: right;"><a href="/admin/users/<?=$next;?>">&nbsp;&nbsp;Next >></a></span>
+ <span style="float: right;"><?=$html->link('&nbsp;&nbsp;Next >>', '/admin/users/' . $next, array('escape' => false)); ?></span>
<?
}
if(isset($previous)) { ?>
- <span style="float: right;"><a href="/admin/users/<?=$previous;?>"><< Previous&nbsp;&nbsp;</a></span>
+ <span style="float: right;"><?=$html->link('<< Previous&nbsp;&nbsp;', '/admin/users/' . $previous, array('escape' => false)); ?></span>
<? } ?>
View
@@ -34,7 +34,7 @@ $('#tabs ul li a').click(function(){ //When any link is clicked
<div id="userAvatar">
<div id="image">
<? if(empty($user['User']['image'])) { ?>
- <img src="/img/answerAvatar.png" />
+ <?=$html->image('answerAvatar.png'); ?>
<? }else {
echo $thumbnail->show(array(
'save_path' => WWW_ROOT . 'img/thumbs',
@@ -142,45 +142,28 @@ echo $thumbnail->show(array(
<td>
<? if(($recent[$key]['History']['type'] == 'asked') || ($recent[$key]['History']['type'] == 'edited')) : ?>
- <a href="/questions/<?= $recent[$key]['Post']['public_key'] ?>/<?= $recent[$key]['Post']['url_title'] ?>">
- <?= $recent[$key]['Post']['title'] ?>
- </a>
+ <?=$html->link($recent[$key]['Post']['title'], '/questions/' . $recent[$key]['Post']['public_key'] . '/' . $recent[$key]['Post']['url_title']);?>
<? elseif($recent[$key]['History']['type'] == 'commented') : ?>
- <? if(isset($recent[$key]['Pad'])) : ?>
- <a href="/questions/<?= $recent[$key]['Pad']['Post']['public_key'] ?>/<?= $recent[$key]['Pad']['Post']['url_title'] ?>">
- <?= $recent[$key]['Pad']['Post']['title'] ?>
- </a>
- <? elseif(isset($recent[$key]['Real'])) : ?>
- <a href="/questions/<?= $recent[$key]['Real']['Post']['public_key'] ?>/<?=$recent[$key]['Real']['Post']['url_title']?>">
- <?= $recent[$key]['Real']['Post']['title'] ?>
- </a>
-
- <? endif; ?>
+ <? if(isset($recent[$key]['Pad'])) : ?>
+ <?=$html->link($recent[$key]['Pad']['Post']['title'], '/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title']);?>
+ <? elseif(isset($recent[$key]['Real'])) : ?>
+ <?=$html->link($recent[$key]['Real']['Post']['title'], '/questions/' . $recent[$key]['Real']['Post']['public_key'] . '/' . $recent[$key]['Real']['Post']['url_title']);?>
+ <? endif; ?>
<? else : ?>
- <a href="/questions/<?= $recent[$key]['Pad']['Post']['public_key'] ?>/<?= $recent[$key]['Pad']['Post']['url_title'] ?>">
- <?= $recent[$key]['Pad']['Post']['title'] ?>
- </a>
+ <?=$html->link($recent[$key]['Pad']['Post']['title'], '/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title']);?>
<? endif; ?>
<? if($recent[$key]['History']['type'] == 'edited') : ?>
<? if(isset($recent[$key]['Pad'])) { ?>
- <a href="/questions/<?= $recent[$key]['Pad']['Post']['public_key'] ?>/<?= $recent[$key]['Pad']['Post']['url_title'] ?>">
- <?= $recent[$key]['Pad']['Post']['title'] ?>
- </a>
+ <?=$html->link($recent[$key]['Pad']['Post']['title'], '/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title']);?>
<? }else { ?>
- <a href="/questions/<?=$recent[$key]['Post']['public_key'];?>/<?=$recent[$key]['Post']['url_title'];?>">
- <?=$recent[$key]['Post']['title'];?>
- </a>
+ <?=$html->link($recent[$key]['Post']['title'], '/questions/' . $recent[$key]['Post']['public_key'] . '/' . $recent[$key]['Post']['url_title']);?>
<? } ?>
<? elseif(isset($recent[$key]['Pad'])) : ?>
- <a href="/questions/<?=$recent[$key]['Pad']['Post']['public_key'];?>/<?=$recent[$key]['Pad']['Post']['url_title'];?>">
- <?=$recent[$key]['Pad']['Post']['title'];?>
- </a>
+ <?=$html->link($recent[$key]['Pad']['Post']['title'], '/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title']);?>
<? else : ?>
- <a href="/questions/<?=$recent[$key]['Post']['public_key'];?>/<?=$recent[$key]['Post']['url_title'];?>">
- <?=$recent[$key]['Post']['title'];?>
- </a>
+ <?=$html->link($recent[$key]['Post']['title'], '/questions/' . $recent[$key]['Post']['public_key'] . '/' . $recent[$key]['Post']['url_title']);?>
<? endif ?>
</td>
@@ -195,9 +178,8 @@ echo $thumbnail->show(array(
<? foreach($recent as $key => $value) { ?>
<p>
<? if($recent[$key]['History']['type'] == 'asked') {
- echo '<a href="/questions/' . $recent[$key]['Post']['public_key'] . '/' . $recent[$key]['Post']['url_title'] . '">
- ' . $recent[$key]['Post']['title'] . '</a>';
- }
+ echo $html->link($recent[$key]['Post']['title'], '/questions/' . $recent[$key]['Post']['public_key'] . '/' . $recent[$key]['Post']['url_title']);
+ }
?>
</p>
<? } ?>
@@ -208,14 +190,11 @@ echo $thumbnail->show(array(
<? foreach($recent as $key => $value) : ?>
<p>
<? if($recent[$key]['History']['type'] == 'answered') : ?>
- <a href="/questions/<?= $recent[$key]['Pad']['Post']['public_key'] ?>/<?= $recent[$key]['Pad']['Post']['url_title'] ?>">
- <?= $recent[$key]['Pad']['Post']['title'] ?>
- </a>
+ <?=$html->link($recent[$key]['Pad']['Post']['title'], '/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title']);?>
<? endif; ?>
<? if($recent[$key]['History']['type'] == 'answered') {
- echo '<a href="/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title'] . '">
- ' . $recent[$key]['Pad']['Post']['title'] . '</a>';
- }
+ echo $html->link($recent[$key]['Pad']['Post']['title'], '/questions/' . $recent[$key]['Pad']['Post']['public_key'] . '/' . $recent[$key]['Pad']['Post']['url_title']);
+ }
?>
</p>
<? endforeach; ?>

2 comments on commit c53fd17

Please sign in to comment.