$this->alt_text = $dict['image_alt_text'];
$this->url = $this->uid . '.' . $dict['image_type'];
}
+
+ public function get_permalink_path() {
+ $permalink = '/data/images/' . $this->url;
+ return $permalink;
+ }
}
function cx_images_add_image($site_id, $alt_text, $image_path, $image_original_filename) {
return;
}
- $permalink = '/data/images/' . $image->url;
-
return array(
'extent' => strlen($matches[0]) + 1,
'element' => array(
'name' => 'img',
'attributes' => array(
- 'src' => cx_url_site($permalink),
+ 'src' => cx_url_site($image->get_permalink_path()),
'alt' => $image->alt_text,
),
),
}
public function get_permalink_path() {
- $post_permalink = $this->is_page ? '/' . $this->slug : '/' . date('Y', $this->date) . '/' . date('m', $this->date) . '/' . $this->slug;
- return $post_permalink;
+ $permalink = '/' . $this->slug;
+ if ($this->is_page == false) {
+ $permalink = '/' . date('Y', $this->date) . '/' . date('m', $this->date) . '/' . $this->slug;
+ }
+ return $permalink;
}
public function get_metadata() {
<table>
<?php foreach (cx_posts_get(include_drafts: true) as $post): ?>
<tr>
- <td class="fill"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a></td>
- <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>">Edit</a></td>
- <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">Delete</a></td>
+ <td class="fill"><a href="<?= cx_url_site($post->get_permalink_path()) ?>"><?= $post->title ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id) ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id) ?>">Delete</a></td>
</tr>
<?php endforeach; ?>
</table>
<table>
<?php foreach (cx_pages_get(navigation_only: false, include_drafts: true) as $post): ?>
<tr>
- <td class="fill"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a></td>
- <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>">Edit</a></td>
- <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">Delete</a></td>
+ <td class="fill"><a href="<?= cx_url_site($post->get_permalink_path()) ?>"><?= $post->title ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id) ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id) ?>">Delete</a></td>
</tr>
<?php endforeach; ?>
</table>
<table>
<?php foreach (cx_images_get() as $image): ?>
<tr>
- <td class="fill"><a href="<?= $image->url ?>"><?= $image->url ?></a></td>
- <td class="hug"><a href="<?= cx_url_admin('/images/edit?id=' . $image->id); ?>">Edit</a></td>
- <td class="hug"><a href="<?= cx_url_admin('/images/delete?id=' . $image->id); ?>">Delete</a></td>
+ <td class="fill"><a href="<?= cx_url_site($image->get_permalink_path()) ?>"><?= $image->url ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/images/edit?id=' . $image->id) ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/images/delete?id=' . $image->id) ?>">Delete</a></td>
</tr>
<?php endforeach; ?>
</table>
<li><a href="<?= cx_url('/'); ?>">Home</a></li>
<?php foreach (cx_pages_get() as $page): ?>
-<li><a href="<?= cx_url('/' . $page->slug); ?>"><?= $page->title ?></a></li>
+<li><a href="<?= cx_url($page->get_permalink_path()); ?>"><?= $page->title ?></a></li>
<?php endforeach; ?>
</ul>
<p>
<?php $number_of_pages = ceil(cx_posts_count() / $posts_per_page); ?>
- <?php if($page_number + 1 < $number_of_pages): ?><a href="<?= cx_url_page($page_number, 1) ?>">Older Posts</a><?php endif; ?>
- <?php if($page_number > 0): ?><a href="<?= cx_url_page($page_number, -1) ?>">Newer Posts</a><?php endif; ?>
+ <?php if($page_number + 1 < $number_of_pages): ?><a href="<?= cx_url_page($page_number, 1) ?>">← Older Posts</a><?php endif; ?>
+ <?php if($page_number > 0): ?><a href="<?= cx_url_page($page_number, -1) ?>">Newer Posts →</a><?php endif; ?>
</p>
</main>