picocms / pico Goto Github PK
View Code? Open in Web Editor NEWPico is a stupidly simple, blazing fast, flat file CMS.
Home Page: http://picocms.org/
License: MIT License
Pico is a stupidly simple, blazing fast, flat file CMS.
Home Page: http://picocms.org/
License: MIT License
Nice work - but sub-directories don't work for me at all (I've tried on 3 separate servers) -- an htaccess issue perhaps?
The variable $_SERVER['SERVER_PROTOCOL'] always returns http plus the used protocol version number. To detect https, the variable $_SERVER['HTTPS'] needs to be used, see:
This results in base_url being set to "http://sitename" even on https sites. Thus also the template resources get linked using http protocol when theme_url is used for including them into the template. On recent Firefox versions http linked resources (e.g. javascript, css, pictures) don't get loaded for security reasons in https sites.
#edit by @PhrozenByte:
You likely got here by chance because it's the first Google result for the error message shown below. Welcome to the GitHub repository of Pico, a stupidly simple, blazing fast, flat file CMS! Even if you don't use Pico, we want to help you. Just refer to last comment of this Issue below to get some general info about the problem you experience: #65 (comment)
I uploaded Pico but I only see a blank php page of death. After turning on error reporting, I get this:
Notice: Use of undefined constant DIR - assumed 'DIR' in /hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on line 5 Warning: require_once(DIR/composer/autoload_real.php): failed to open stream: No such file or directory in /hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on line 5 Fatal error: require_once(): Failed opening required 'DIR/composer/autoload_real.php' (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/livenoma/writemorefaster.com/vendor/autoload.php on line 5
I figured I had the wrong version of PHP, but I just checked and am running 5.2.10. Any ideas?
Here is my phpinfo: http://www.writemorefaster.com/test.php
Is there some way to sort posts? Maybe a generic set of sorting options, such as alphabetical according to title, by date, by a number (that may be hidden in the header of the markdown file and just used for sorting) would help.
Hi there,
Looking at some of the issues and I saw that 404 request/question/commit that someone else brought up.
I'm not overly familiar with Twig, and I notice that there is no header generation (common http headers) in the Pico class. Does Twig handle this?
I have created a new theme based on the default one in a directory "viv" and set the config.php like this:
$config['theme'] = 'viv';
But it is still the default theme which is "loaded": the changes I made in the "viv" theme are not taken into account, but if I change anything in the default theme, it is taken into account.
I am probably blind or stupidly simpler than Pico, but do you have any idea where it could come from?
I am making a members area and want to password protect a folder. I chose htaccess for now but a php include I also have available is not working too. First htaccess.
I have done this many times in the past and it works fine. Same here. I add .htaccess into the folder to protect and have the path to the .htpasswd file in there. Proof it works - If I manually type in the path to this folder I get the password window showing, great. Now the problem is that Pico does not use the "content" folder in it's url, so if I click on the menu item to any specific file in this folder, everything just shows without any password prompt. I've tried adding to the root .htaccess file the "File" directive amougst others and have had no luck doing anything. Any suggestions on how to make this work?
Re: the php include method, I added the include to the very top of my template and that does not work either. The php include code shows on the source code of the page in the browser. Any tips would be appreciated.
It would be nice if the docs inform that you need the .htaccess file if you want the subdirectories to work.
Also you don't provide the .htaccess file with the default download, you have to take it from the Github repo, so state it clearly in the docs that you need it.
to support the latest phpmarkdown (1.3) version, following changes are needed:
$content = Markdown::defaultTransform($content);
instead of:
$content = Markdown($content);
Note: I removed the namespace declaration from markdown.php
I wrote a few test posts in markdown and used the default meta block at the top with the date included. The posts are now showing up in the main nav of the site along with the default pages.
I used the code on Pico's documentation page to make my site into a blog. Here's the code from that page:
{% if is_front_page %} <!-- Front page lists all blog posts -->
<div id="posts">
{% for page in pages %}
{% if page.date %} <!-- Note we check for Date field (posts) here -->
<div class="post">
<h3><a href="{{ page.url }}">{{ page.title }}</a></h3>
<p class="meta">{{ page.date_formatted }}</p>
<p class="excerpt">{{ page.excerpt }}</p>
</div>
{% endif %}
{% endfor %}
</div>
{% else %} <!-- Single page shows individual blog post -->
<div class="post">
{% if meta.title %}<h2>{{ meta.title }}</h2>{% endif %}
<p class="meta">{{ meta.date_formatted }}</p>
{{ content }}
</div>
{% endif %}
I double-checked and only posts have dates in the meta field and pages do not. I also changed out the nav section to this per @gilbitron's suggestion:
{% if not page.date %}
<li><a href="{{ page.url }}">{{ page.title }}</a></li>
{% endif %}
but now the nav does not display at all. The HTML is outputting correctly from the nav code, but there are no links (hopefully that makes sense).
This is completely new to me, but I found it looking for a good flat file solution. Is showing the categories and pages/posts within those categories not possible? I am only seeing the ability to find all pages within not in any structure.
Just looking to have a category list and page/post list for the category in the sidebar. Maybe I am missing something or didn't look at the format enough.
I can get the following working throughout my installation:
$config['custom_setting'] = 'Hello'; // Can be accessed by {{ config.custom_setting }} in a theme
I did originally assume though that I could create my own custom variables/settings in the config file and call them but have had no luck in doing so.
Able I able to create more than one custom setting?
Is there a way to use the page slug (file name) in the template? For the life of me I can't figure it out with the available documentation.
I installed Pico on my localhost, running PHP 5.4
When I try and go into a sub page I get the following error when accessing http://localhost/~Sebastian/github/pico/sub/
Not Found
The requested URL /Volumes/Secondary HD/Sebastian/Sites/github/pico/index.php was not found on this server.
The main page works fine though.
Warning: require_once(DIR/composer/autoload_real.php) [function.require-once]: failed to open stream: No such file or directory in /home/himaliki/public_html/vendor/autoload.php on line 5
Pico works fine on my local host, I cannot get pico to run on live server @hostgator I keep getting a timezone error, and subsequent -- Class 'Pico' not found error, any idea how to fix it,
Warning: main() [function.main]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CDT/-5.0/DST' instead
After installing Pico on my server, the index works, but attempts to go to other pages result in a 500 Internal server error.
Found at the bottom of http://pico.dev7studios.com/
I'm using Pico for two days now, and really like it. I was looking for something that, well, turns out to be exactly Pico. Good job!
Little suggestion.
Right now, the metadata values available for a page are: Title, Description, Author, Date and Robots. That's good. But what if I write articles in several language and want to do something different according to the language? What if I want some articles to be hidden for now? What if I decide to have several categories with their articles listed at different places?
I guess, what would be nice, would be a complete freedom of metadata. being able to define “Language: Danish” or “Visibility: Hidden” or anything else in the header of my articles and be able to access it in my template. {{ meta.language }} ? {{ meta.visibility }} ? They virtually all exist!
Alternatively, there could be only one new metadata field, something like “Tags”, where the author can put anything she or he wants to use later in a way or another.
Hello,
I'm looking forward using Pico on my website, but ran into this error message:
Warning: require_once(__DIR__/composer/autoload_real.php) [function.require-once]: failed to open stream: No such file or directory in /homez.406/probable/www/txt/vendor/autoload.php on line 5
Fatal error: require_once() [function.require]: Failed opening required '__DIR__/composer/autoload_real.php' (include_path='.:/usr/local/lib/php') in /homez.406/probable/www/txt/vendor/autoload.php on line 5
Pico is installed in a sub-folder named /txt.
Since installing Pico, I get this issue on the top of every page:
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 166
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 166
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 166
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 166
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 234
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 234
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 234
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 234
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 234
Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /hsphere/local/home/livenoma/writemorefaster.com/lib/pico.php on line 234
Hi, really nice cms so far. How can i make some new content-types? Like Events or Meetings?
I have tried to give them special names like event_one.md, or meeting_thisfriday.md.
But i don't know to filter them.
Second idea was to filter them by the Meta-Datas. Like Type: Event. But how to enable this filter like ?
if ( page.type = 'event' )
Thank you very much.
Cheers Dirk
Hi,
Pico look's good but how I generate a Navigation Menu ?
Please update the documentation.
THX
base_url function returns wrong value when there is a substring of server name in the url. eg:
request_url: localhost/pico/local -> base_url = host/pico/ (pico installed in pico subfolder)
request_url: localhost/local -> base_url = host/
request_url: www.technology.com/tech -> base_url = www.nology.com/
solution:
private function base_url()
{
global $config;
if(isset($config['base_url']) && $config['base_url']) return $config['base_url'];
$url = '';
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
$script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
if($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
$protocol = $this->get_protocol();
return $protocol . '://' . rtrim(str_replace('/'.$url, '/', $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), '/');
}
+@mathroc
Is there a way to get a specific pages content? e.g. {{ content.page }}
or even better direct as markdown % content.page %
?
I recently wrote an article with source code in scala - and pico stripped the scaladoc completely.
This is the markdown for the article:
...
Here's the code from the ``PageRecommender`` trait.
trait PageRecommender {
/**
* Gets some urls and returns the recommended ones - based on the given data.
*
* @param urls - base data for recommendation
* @return recommended urls
*/
def recommend(urls: Traversable[String]): Traversable[String]
}
Here's the code from the ``DeliciousUserBasedPageRecommender`` class. It does all the heavy work of finding some new and possibly interesting URLs.
...
After pico processed it, this came out:
...
Here's the code from the PageRecommender trait.
trait PageRecommender {
def recommend(urls: Traversable[String]): Traversable[String]
}
Here's the code from the DeliciousUserBasedPageRecommender class. It does all the heavy work of finding some new and possibly interesting URLs.
...
I searched a little bit in the source-code and found this line in lib/pico.php
, causing the issue:
...
$content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta
...
I also found a possible fix, that works for me as a workaround:
...
//Added number 1 as third argument, to only replace the first finding!
$content = preg_replace('#/\*.+?\*/#s', '', $content, 1); // Remove comments and meta
...
Thanks for the great work so far. Hope this helps.
Is there a way to limit the depth of the menu items? Is it possible to only show top level pages, one folder deep pages etc.?
OS: Debian - PHP/5.3.3-7
following found in/var/log/apache2/error.log
[Mon Jul 08 12:01:46 2013] [notice] Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze15 with Suhosin-Patch configured -- resuming normal operations
[Mon Jul 08 12:01:52 2013] [error] [client X.x.x.x] PHP Fatal error: Cannot redeclare class Twig_Filter_Node in /var/www/vendor/twig/twig/lib/Twig/Node.php on line 39
Could you assist in any changes required to fix this error
On the default install in the sub folder there are two files, index.md and page.md, would it be possible to make page a child of index on the menu?
The return for the get_config method should be return $config not return $defaults. This has the effect of ignoring custom config settings.
Hello,
Not sure if there is a reason for it, but how come you have committed the vendor folder? This should be created by composer install
.
Also, the composer.lock file could do with committing. See: http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
Apologies if this has already been discussed. I did look through closed issues but could not find anything.
Scott
Why are the files holding markdown content by default displayed as .txt? Should they not be .md?
If the files were a markdown file extension, most text editors & IDEs will assign markdown syntax colouring automatically. ie Sublime Text
When I write in markdown I often wrap my images in a <div>
tag to prevent them from being encased in an <p>
tag. The syntax looks like this:
<div markdown="1"> ![](/images/2013/06/2013-06-15-untited.jpg "") </div>
I've never run into an issue with this until now with Pico.
Typically this markdown converts to HTML without any issue and renders the following:
<div> <img src="/images/2013/06/2013-06-15-untited.jpg"> </div>
with the actual image showing up where it should.
With Pico the following renders:
<div> ![](/images/2013/06/2013-06-15-untited.jpg "") </div>
with the raw markdown code rendering and not converting into proper html.
Is this an issue with pico or more the markdown generator/flavour/parser that is being use? If it is the later, is there a way to specify what flavour of markdown to use or add support for extended Markdown capabilities?
Hello,
I have a question or maybe a feature request.
Is it possible to configure multi column layouts?
For example: 2 Column Layout with Content-Column and Sidebar.
How can I do this? Currently I think it is not possible, because {{ content }} contains the complete parsed file, an I could not set to separate marker for each column or can define which code from my index.md file should be rendered in {{ content }} and which e.g. in a custom marker like {{ sidebar }}
I run my pico site out of SVN, so I can version control my .md files
pico barfs loading the plugins directory, because it finds the version in .svn/text-base/pico_plugin.php and complains 'Cannot redeclare class Pico_Plugin'
delete this one
Hi,
It's more a question than an issue,
Is it possible easily with pico to add syntax highlighting into markdown parsing/rendering ?
Best.
I'm trying to run pico with appserv but i'm getting these errors:
Warning: require_once(__DIR__/composer/autoload_real.php) [function.require-once]: failed to open stream: No such file or directory in C:\AppServ\www\pico\vendor\autoload.php on line 5
Fatal error: require_once() [function.require]: Failed opening required '__DIR__/composer/autoload_real.php' (include_path='.;C:\php5\pear') in C:\AppServ\www\pico\vendor\autoload.php on line 5
In get_pages for each page the function parse_content will be called, in my little test environment with some hooks, the method get_pages is called 5 times which calls parse_content 5 times for all 20 pages, so with every request parse_content will be called 100 times.
Can we cache the calls (Singleton) or better, call parse_content only, if the parsed_content property is used.
I am trying to set up a contact form on my site. How and where would I put my php code so that when I click a button on my contact page I can link a php script to the button.
Thanks in advance and sorry if this seems like a really dumb question, I am very new to web development.
I've been playing around with Pico and it's very cool! The only major addition I'd like to see is support for CSS preprocessors like Less, Sass, and Stylus.
I've been trying to create a Less plugin myself, but all I've succeeded in doing is proving I can't code.
The .htaccess is not getting cloned from the git repository not sure if that file is getting ignored, also im having routing issues, i added that .htaccess from the repository to my test server but only the main page is working www.abc.com/ works but www.abc.com/sub/ does not work im sure its related to the .htaccess here is my configs.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Options -Indexes
I already changed the setting in config.php but still set to "Pico". Do I need to clear a cache?
Hello
I installed locally Pico cms on windows . But I can not access the administration function to create/edit content, create new pages, etc.Only shows the front end
.
Please, add pagination to a blog.
Hi,
I'm trying to run Pico on lighttpd. Going to a sub page brings me the 404 error, but it's the lighttp 404-page not the custom one of Pico.
I think this has to do with running on lighttpd and not apache which handles the .htaccess file but I'm not sure. Is that the case or is there any other issue? If yes, is it possible to run Pico on lighttpd?
At least it should be. It's a "Blazing Fast" and "seriously lightweight" CMS so it should be possible to run it on a lightweight and fast webserver instaed of apache...
I have a quick question: When blogging with Pico (using the same snippet of code found in the official docs), every page (with the exception of the article listing page) has a title and date at the top. While this is perfectly acceptable for blog posts, it doesn't make sense to have this at the top of an "About" page. I've tried different combinations of if
statements and Pico/Twig variables, but I can't seem to remove the date and title from any specific page. I've also tried using the Advanced Meta plugin and loading a custom template, but the documentation on that is scarce.
I'm at a complete loss as to why I can't figure out a way around this seemingly simple problem. Any thoughts?
Also, If I haven't really made myself that clear on what I'm trying to accomplish here, I can post some screenshots.
When config[base_url] is not set and any sub-pages are opened the base_url is not setting correctly.
For that issue link to the site_title is not pointing to the correct url from sub-page in the default template.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.