Creates default pages
436466
protected function createPages()
    {
        $this->setCliMessage('Creating pages...');

        $pages = array();

        $pages[] = array(
            'title' => 'Contact us',
            'description' => 'Contact information',
        );

        $pages[] = array(
            'title' => 'Help',
            'description' => 'Help information. Coming soon...',
        );

        foreach ($pages as $page) {

            $page += array(
                'status' => 1,
                'user_id' => $this->context['user_id'],
                'store_id' => $this->context['store_id']
            );

            $this->getPageModel()->add($page);
        }
    }
735394
public function new_page()
    {
        $this->_page_number++;
        $this->_page_count++;

        $this->_img = imagecreatetruecolor($this->_actual_width, $this->_actual_height);

        $this->_bg_color = $this->_allocate_color($this->_bg_color_array);
        imagealphablending($this->_img, true);
        imagesavealpha($this->_img, true);
        imagefill($this->_img, 0, 0, $this->_bg_color);

        $this->_imgs[] = $this->_img;
    }
589899
public final function CreatePage()
	{
		$method = strtoupper($this->_context->get("REQUEST_METHOD"));

		$customAction = strtolower($method) . ucfirst($this->_action);

		if (method_exists($this, $customAction))
			$this->$customAction($this->getRawRequest(), $this->_context->get("id"));
		else
			throw new BadMethodCallException("The method '$customAction' does not exists.");

		return $this->defaultXmlnukeDocument;
	}
936996
public function requireDefaultRecords()
    {
        parent::requireDefaultRecords();
        if (NewsHolderPage::get()->count() === 0) {
            /** @var NewsHolderPage $page */
            $page = NewsHolderPage::create();
            $page->Title = _t('NewsHolderPage.DEFAULTPAGETITLE', 'Newspage');
            $page->Content = '';
            $page->URLSegment = 'news';
            $page->Sort = 1;
            $page->Status = 'Published';
            $page->IsPrimary = true;
            $page->write();
            $page->publish('Stage', 'Live');
            $page->flushCache();
            DB::alteration_message('Newsholder Page created', 'created');
        } else {
            /** Migration is only possible, if the module is installed. We're assuming, this means there's at least one Holderpage. */
            $this->migrateUp();
        }
    }
576706
def pages_menu(context, page, url='/'):
    
    lang = context.get('lang', pages_settings.PAGE_DEFAULT_LANGUAGE)
    page = get_page_from_string_or_id(page, lang)
    if page:
        children = page.get_children_for_frontend()
        context.update({'children': children, 'page': page})
    return context
656011
def populate_pages(self, parent=None, child=5, depth=5):
        """"""
        User = get_user_model()
        from basic_cms.models import Content
        author = User.objects.all()[0]
        if depth == 0:
            return
        p = self.model(parent=parent, author=author, status=self.model.PUBLISHED)
        p.save()
        p = self.get(id=p.id)
        Content(body='page-' + str(p.id), type='title', language=settings.PAGE_DEFAULT_LANGUAGE, page=p).save()
        Content(body='page-' + str(p.id), type='slug', language=settings.PAGE_DEFAULT_LANGUAGE, page=p).save()
        for child in range(1, child + 1):
            self.populate_pages(parent=p, child=child, depth=(depth - 1))
480672
private static function initPages()
    {
        $modelPage = Yii::createObject(Page::class);
        $pages = $modelPage::find()->getMap()->asArray()->all();

        if ($pages) {
            foreach ($pages as $page) {
                self::$pages[$page['id']] = $page;
            }
        }

    }
1147056
function createPage(filename) {
        let page = {
            path: filename,
            rawContent: fs.readFileSync(filename, "utf8"),
            name: path.basename(filename).replace(/\.[^/.]+$/, ""),
            filename: path.basename(filename),
            folder: path.dirname(filename),
            ext: path.extname(filename),
            userData: {}
        };
        page.isMarkdown = page.ext.toLocaleUpperCase() == ".MD";
        if (page.isMarkdown)
            page.ext = ".html";
        page.template = doT.template(page.rawContent, null, page.userData);
        page.outPath = path.join(path.relative(CONTENT, page.folder), page.name + page.ext);
        page.href = CONFIG.prefix + page.outPath;
        return page;
    }
1217440
def pages(*args)
      return if args.nil? or args.empty?

      test_file_dir = class_eval{  self::TestFileDir }
      default_page_dir = File.join(test_file_dir, "pages")
      #puts "debug: default_page_dir :#{default_page_dir}}"
      page_dir = default_page_dir

      page_files = []
      args.each do |x|
        if x.class == Hash && x[:page_dir]
          page_dir = x[:page_dir]
        else
          page_files << x
        end
      end

      if page_files.size == 1 && page_files[0] == :all
        Dir[File.expand_path(page_dir)+ "/*_page.rb"].each { |page_file|
          load page_file
        }
        return
      end

      page_files.each do |page|
        page_file = File.join(page_dir, page.to_s)
        load page_file
      end
    end
541721
public function create()
    {
        $content = '';
        $pageNumber = $this->getPageNumber();

        if ($pageNumber === 0) {
            $pageNumber = 1;
        }

        if ($this->lastPage > 1) {
            $content .= "<div class='pagination'>";

            $content .= $this->renderPreviousLink($pageNumber);

            //not enough pages to bother breaking it up
            if ($this->lastPage < 7 + ($this->adjacent * 2)) {
                for ($counter = 1; $counter <= $this->lastPage; $counter++) {
                    $content .= $this->createCurrentActiveLink($pageNumber, $counter);
                }
            } elseif ($this->lastPage > 5 + ($this->adjacent * 2)) {
                //close to beginning; only hide later pages
                if ($pageNumber < 1 + ($this->adjacent * 2)) {
                    for ($counter = 1; $counter < 4 + ($this->adjacent * 2); $counter++) {
                        $content .= $this->createCurrentActiveLink($pageNumber, $counter);
                    }
                    $content .= '...';
                    $content .= $this->createSecondLink();
                } elseif (
                    $this->lastPage - ($this->adjacent * 2) > $pageNumber
                    && $pageNumber > ($this->adjacent * 2)
                ) {
                    $content .= $this->createPrimaryLink();
                    $content .= '...';

                    for (
                        $counter = $pageNumber - $this->adjacent;
                        $counter <= $pageNumber + $this->adjacent;
                        $counter++
                    ) {
                        $content .= $this->createCurrentActiveLink($pageNumber, $counter);
                    }

                    $content .= '...';
                    $content .= $this->createPrimaryLink();
                    $content .= $this->createSecondLink();
                } else {
                    //close to end; only hide early pages

                    $content .= $this->createPrimaryLink();

                    $content .= '...';
                    for (
                        $counter = $this->lastPage - (2 + ($this->adjacent * 2));
                        $counter <= $this->lastPage;
                        $counter++
                    ) {
                        $content .= $this->createCurrentActiveLink($pageNumber, $counter);
                    }
                }
            }

            $content .= $this->renderNextLink($counter, $pageNumber);
        }

        $this->paginationLinks = $content;
    }
87367
def home
      @page = Page.where(is_default: true).first || Page.first || create_default_page
      authorize!(:show, Page)
      respond_to do |format|
        format.html { render (@page.template.present? ? @page.template : 'show'), notice: @page.new_record? ? 'No Pages Found.' : '' }
        format.json { render json: @page }
      end
    end
846553
async function createPages({ actions: { createPage } }) {
  if (includeDevPages) {
    createPage({
      path: '/dev/logos',
      component: require.resolve('./frontend/components/development/logo-page'),
    })
  }

  categories.forEach(category => {
    const { id } = category
    createPage({
      path: `/category/${id}`,
      component: require.resolve('./frontend/components/main'),
      // `context` provided here becomes `props.pageContext` on the page.
      context: { category },
    })
  })
}
192880
def create_page(pagename):
    
    page = pagename.lstrip("/").rstrip("/")
    _, _ext = os.path.splitext(pagename)

    # If the file doesn't have an extension, we'll just create one
    if not _ext or _ext == "":
        page += ".jade"

    if not page.endswith(PAGE_FORMAT):
        error("Can't create '%s'" % page)
        print("Invalid filename format")
        print("Filename must be in: '%s'" % " | ".join(PAGE_FORMAT))
    else:
        engine = Yass(CWD)
        markup = "jade"
        if page.endswith(".md"):
            markup = "md"
        if page.endswith(".html"):
            markup = "html"

        dest_file = os.path.join(engine.pages_dir, page)
        dest_dir = os.path.dirname(dest_file)

        content = TPL_HEADER
        content += TPL_BODY[markup]

        if os.path.isfile(dest_file):
            error("File exists already")
            print("Location: %s" % dest_file)

        else:
            if not os.path.isdir(dest_dir):
                os.makedirs(dest_dir)
            with open(dest_file, "w") as f:
                f.write(content)

            print("New page created: '%s'" % page)
            print("Location: %s" % dest_file)


    footer()
592177
def add_page(self, title=None, content=None, old_url=None,
                 tags=None, old_id=None, old_parent_id=None):
        
        if not title:
            text = decode_entities(strip_tags(content)).replace("\n", " ")
            title = text.split(". ")[0]
        if tags is None:
            tags = []
        self.pages.append({
            "title": title,
            "content": content,
            "tags": tags,
            "old_url": old_url,
            "old_id": old_id,
            "old_parent_id": old_parent_id,
        })
962555
protected function _pages()
    {
        $pages = new AnConfig();
        $current  = ($this->current - 1) * $this->limit;
        
        // First
        $page    = 1;
        $offset  = 0;
        $active  = $offset != $this->offset;
        
        $pages->first = array(
            'title' => 'First', 
            'page' => 1, 
            'offset' => $offset, 
            'limit' => $this->limit, 
            'current' => false, 
            'active' => $active, 
            'rel' => 'first'
        );
      
        // Previous
        $offset  = max(0, ($this->current - 2) * $this->limit);
        $active  = $offset != $this->offset;
        $pages->prev = array(
            'title' => 'Prev', 
            'page' => $this->current - 1, 
            'offset' => $offset, 
            'limit' => $this->limit, 
            'current' => false, 
            'active' => $active, 
            'rel' => 'prev'
        );

        // Pages
        $offsets = array();
        foreach ($this->_offsets() as $page => $offset) {
            $current = $offset == $this->offset;
            $offsets[] = array(
                'title' => $page, 
                'page' => $page, 
                'offset' => $offset, 
                'limit' => $this->limit, 
                'current' => $current, 
                'active' => !$current
            );
        }
        
        $pages->offsets = $offsets;
        
        // Next
        $offset = min(($this->count-1) * $this->limit, ($this->current) * $this->limit);
        $active = $offset != $this->offset;
        $pages->next = array(
            'title' => 'Next', 
            'page' => $this->current + 1, 
            'offset' => $offset, 
            'limit' => $this->limit, 
            'current' => false, 
            'active' => $active, 
            'rel' => 'next'
        );
       
        // Last
        $offset  = ($this->count - 1) * $this->limit;
        $active  = $offset != $this->offset;
        $pages->last = array(
            'title' => 'Last', 
            'page' => $this->count, 
            'offset' => $offset, 
            'limit' => $this->limit, 
            'current' => false, 
            'active' => $active, 
            'rel' => 'last'
        );
        
        return $pages;
    }
453134
def add_page(self, page, default = True):
        
        """
        self._pages[page.page_id] = page
        page._add_display(self)
        if default or not self._active_page:
            self._active_page = page
761795
def add_pages(self, path='pages'):
		
		pages_path = os.path.join(self.root_path, path)
		pages = []
		for file in _listfiles(pages_path):
			page_dir = os.path.relpath(os.path.dirname(file), pages_path)
			if page_dir == '.':
				page_dir = None
			pages.append(self.cm.Page.from_file(file, directory=page_dir))
		self.cm.add_pages(pages)