Skip to content

Commit

Permalink
Corrected a logic issue with @Projects_Count
Browse files Browse the repository at this point in the history
  • Loading branch information
kolber committed Sep 11, 2009
1 parent 575f568 commit 40be422
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/stacey.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ function __construct($page_name) {
$this->store_unclean_page_names('../content/');
$this->page_name_unclean = $this->unclean_page_name($this->page);
$this->projects_folder_unclean = $this->unclean_page_name('projects');
$this->store_unclean_page_names('../content/'.$this->projects_folder_unclean);

$this->template_file = $this->get_template_file();
$this->content_file = $this->get_content_file();
Expand Down Expand Up @@ -354,17 +355,18 @@ function preparse($text) {
}

function create_replacement_rules($text) {
// additional, useful values
$replacement_pairs = array(
"/@Images_Count/" => count($this->page->image_files),
"/@Projects_Count/" => count($this->page->unclean_page_names),
);

if(isset($this->page->sibling_projects)) {
$np = new NextProjectPartial;
$pp = new PreviousProjectPartial;
// additional, useful values
$replacement_pairs = array(
"/@Images_Count/" => count($this->page->image_files),
"/@Projects_Count/" => count($this->page->unclean_page_names),
"/@Project_Number/" => $this->page->page_number,
"/@Previous_Project/" => $pp->render($this->page->sibling_projects[0]),
"/@Next_Project/" => $np->render($this->page->sibling_projects[1])
);
$replacement_pairs["/@Project_Number/"] = $this->page->page_number;
$replacement_pairs["/@Previous_Project/"] = $pp->render($this->page->sibling_projects[0]);
$replacement_pairs["/@Next_Project/"] = $np->render($this->page->sibling_projects[1]);
}

preg_match_all('/[\w\d_-]+?:[\S\s]+?\n\n/', $text, $matches);
Expand Down

0 comments on commit 40be422

Please sign in to comment.