How to make a theme Yellow
Yellow studies for some time, has recently been looking at the code related topics, when you first saw the theme code Yellow, a little ignorant force, feels a bit messy, the default theme of class documents in html or php id are basically used directly generation, so I feel like this is not convenient, in fact, the core function and html templates can be changed, theme ideas and typecho actually is about the same, or even more flexibility, you can go a lot less judgment, so that the whole topic more flexible, do not apply the theme is also very convenient.
Yellow theme structure
php file in the system/themes/snippets in this folder are use to the subject of some components, you can customize. For example:
snippets/--------- content-blog.php article page module --------- content-blogpages.php blog Home module --------- footer.php tail module --------- header.php head module --------- navigation.php navigation module --------- pages.php I myself built, it can be understood as independent page module --------- pages-404.php I myself built, 404 pages flip module module --------- pagination.php
You can add or delete their own modules to use according to their needs, I think this is really pretty cool, so that the template can have many variations.
Yellow commonly used functions
Yellow comes with a lot of functions, but in fact we do if they do not need so many themes completely function, it is important to say something, just to retain part of php, css and html can be customized.
Head function, pay attention to Yellow default theme css, js, header header information, including the Yellow-bar, are through to the output of this function ,, you can edit the system \ plugins \ Edit.js be modified.
? Php echo $ yellow-page-getExtra (header)?/Code
Loading navigation
? Php $ yellow-snippet ($ yellow-page-get (navigation))?
It can be written in navigation.php, the meaning is the output of all the navigation pages.
? Php $ pages = $ yellow-pages-top () php $ yellow-page-setLastModified ($ pages-getModified ()) php foreach ($ pages as $ page): A class = sidebar-nav- ?? item php echo $ page-isActive () current:? href = php echo $ page-getLocation (true) ?? php echo $ page-getHtml (titleNavigation)/a php endforeach
Site Name
? Php echo $ yellow-page-getHtml (sitename)?
Article Title
? Php echo $ yellow-page-getHtml (titleContent)?
Article title link
? Php echo $ page-getLocation (true)?
Articles Published
? Php echo $ yellow-page-getDateHtml (published)?
Article body
? Php echo $ yellow-page-getContent ()?
Article tags must first determine whether there was displayed.
? Php if ($ yellow-page-isExisting (tag)):?? Php echo $ yellow-text-getHtml (blogTag) ?? php $ tagCounter = 0; foreach (preg_split (/ \ s *, \ s * /, $ yellow-page-get (tag)) as $ tag) {if (++ $ tagCounter1) echo, echo a class = 'tag' href = \. $ yellow-page-getPage (blog) -getLocation (true). $ yellow-toolbox-normaliseArgs.. (tag: $ tag) \ htmlspecialchars ($ tag) ./ a} php endif???
Loading page.
? Php $ yellow-snippet (pagination, $ yellow-page-getPages ())?
It can be written in pagination.php, the flip effect is, Previous, Next case.
? Php list ($ name, $ pages) = $ yellow-getSnippetArgs () php if ($ pages-isPagination ()): Php if ($ pages-getPaginationPrevious ()):?? A href = php echo $ pages-getPaginationPrevious () ?? php echo $ yellow-text-getHtml (paginationPrevious)/a php endif php if ($ pages-getPaginationNext ()): a href = php echo $ pages-getPaginationNext ( ) ?? php echo $ yellow-text-getHtml (paginationNext)?/a? php endif?? php endif?
In the content-blogpages.php, the output of all articles list.
? Php foreach ($ yellow-page-getPages () as $ page): Php echo $ page-getDateHtml (published) a href = '?? Php echo $ page-getLocation (true)' php echo $ page -getHtml (title)/a php echo $ yellow-toolbox-createTextDescription ($ page-getContent (), 0, false, -??! more -.., a href = \ $ page-getLocation (true) \ . $ yellow-text-getHtml (blogMore) ./ a)?? php endforeach?
Tail function
? Php echo $ yellow-page-getExtra (footer)?
About page template
Yellow page templates that can be customized to create a new xxx.html file in system/themes/templates directory, custom content inside, then this is a new template.
In the new page when the head input Template: xxx on it, a new page is to xxx.html as a template.
Template files created in the system/themes/templates, are using the system/themes/snippets inside components, such as:
? Php $ yellow-snippet (header)?? Php $ yellow-snippet (content-blogpages)?? Php $ yellow-snippet (footer)?
system/themes/snippets which can reference the components are very convenient.
It is not known how to achieve articles on inside pages of one and the next one function, and how to judge another Yellow is not clear, then free under study. (Has been resolved, see here.)
Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/netweb/How-to-make-a-theme-Yellow.htm