mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 12:36:23 +05:30
Add new var
This commit is contained in:
parent
49898f79ac
commit
e0952de166
3 changed files with 25 additions and 16 deletions
|
|
@ -984,6 +984,7 @@ function find_draft_page($static = null)
|
||||||
$post->md = $v['basename'];
|
$post->md = $v['basename'];
|
||||||
$post->slug = $url;
|
$post->slug = $url;
|
||||||
$post->parent = null;
|
$post->parent = null;
|
||||||
|
$post->parentSlug = null;
|
||||||
|
|
||||||
// Get the contents and convert it to HTML
|
// Get the contents and convert it to HTML
|
||||||
$content = file_get_contents($post->file);
|
$content = file_get_contents($post->file);
|
||||||
|
|
@ -1027,23 +1028,27 @@ function find_draft_subpage($static = null, $sub_static = null)
|
||||||
|
|
||||||
$post = new stdClass;
|
$post = new stdClass;
|
||||||
|
|
||||||
|
$fd = str_replace('content/static/', '', dirname($v['dirname']));
|
||||||
|
|
||||||
|
$pr = explode('.', $fd);
|
||||||
|
if (isset($pr[1])) {
|
||||||
|
$ps = $pr[1];
|
||||||
|
} else {
|
||||||
|
$ps = $fd;
|
||||||
|
}
|
||||||
|
|
||||||
// The static page URL
|
// The static page URL
|
||||||
$fn = explode('.', $v['filename']);
|
$fn = explode('.', $v['filename']);
|
||||||
|
|
||||||
if (isset($fn[1])) {
|
if (isset($fn[1])) {
|
||||||
$url = $fn[1];
|
$url = $fn[1];
|
||||||
} else {
|
} else {
|
||||||
$url= $v['filename'];
|
$url = $v['filename'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($static)) {
|
$post->parent = $fd;
|
||||||
$parent = str_replace('content/static/', '', dirname($v['dirname']));
|
$post->parentSlug = $ps;
|
||||||
$post->parent = $parent;
|
$post->url = site_url() . $ps . "/" . $url;
|
||||||
$post->url = site_url() . $parent . "/" . $url;
|
|
||||||
} else {
|
|
||||||
$post->parent = $static;
|
|
||||||
$post->url = site_url() . $static . "/" . $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
$post->file = $v['dirname'] . '/' . $v['basename'];
|
$post->file = $v['dirname'] . '/' . $v['basename'];
|
||||||
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
|
$post->lastMod = strtotime(date('Y-m-d H:i:s', filemtime($post->file)));
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
<?php if (!empty($draftSubpages)):?>
|
<?php if (!empty($draftSubpages)):?>
|
||||||
<br><br>
|
<br><br>
|
||||||
<hr>
|
<hr>
|
||||||
<h2 class="post-index"><?php echo i18n('Draft');?>: Subpages</h2>
|
<h2 class="post-index"><?php echo i18n('Draft');?>: Sub <?php echo i18n('pages');?></h2>
|
||||||
<table class="table post-list">
|
<table class="table post-list">
|
||||||
<tr class="head">
|
<tr class="head">
|
||||||
<th><?php echo i18n('Title');?></th>
|
<th><?php echo i18n('Title');?></th>
|
||||||
|
|
|
||||||
|
|
@ -560,6 +560,7 @@ function get_pages($pages, $page = 1, $perpage = 0)
|
||||||
$post->md = $v['basename'];
|
$post->md = $v['basename'];
|
||||||
$post->slug = $url;
|
$post->slug = $url;
|
||||||
$post->parent = null;
|
$post->parent = null;
|
||||||
|
$post->parentSlug = null;
|
||||||
|
|
||||||
// Get the contents and convert it to HTML
|
// Get the contents and convert it to HTML
|
||||||
$content = file_get_contents($post->file);
|
$content = file_get_contents($post->file);
|
||||||
|
|
@ -628,7 +629,8 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
|
||||||
|
|
||||||
$post->md = $v['basename'];
|
$post->md = $v['basename'];
|
||||||
$post->slug = $url;
|
$post->slug = $url;
|
||||||
$post->parent = $static;
|
$post->parent = $fd;
|
||||||
|
$post->parentSlug = $static;
|
||||||
|
|
||||||
// Get the contents and convert it to HTML
|
// Get the contents and convert it to HTML
|
||||||
$content = file_get_contents($post->file);
|
$content = file_get_contents($post->file);
|
||||||
|
|
@ -1860,6 +1862,7 @@ function static_prev($prev)
|
||||||
'md' => $prev->md,
|
'md' => $prev->md,
|
||||||
'slug' => $prev->slug,
|
'slug' => $prev->slug,
|
||||||
'parent' => $prev->parent,
|
'parent' => $prev->parent,
|
||||||
|
'parentSlug' => $prev->parentSlug,
|
||||||
'file' => $prev->file,
|
'file' => $prev->file,
|
||||||
'readTime' => $prev->readTime,
|
'readTime' => $prev->readTime,
|
||||||
'lastMod' => $prev->lastMod
|
'lastMod' => $prev->lastMod
|
||||||
|
|
@ -1879,6 +1882,7 @@ function static_next($next)
|
||||||
'md' => $next->md,
|
'md' => $next->md,
|
||||||
'slug' => $next->slug,
|
'slug' => $next->slug,
|
||||||
'parent' => $next->parent,
|
'parent' => $next->parent,
|
||||||
|
'parentSlug' => $next->parentSlug,
|
||||||
'file' => $next->file,
|
'file' => $next->file,
|
||||||
'readTime' => $next->readTime,
|
'readTime' => $next->readTime,
|
||||||
'lastMod' => $next->lastMod
|
'lastMod' => $next->lastMod
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue