EzDevInfo.com

pyrocms

PyroCMS is an MVC PHP Content Management System built to be easy to use, theme and develop with. It is used by individuals and organizations of all sizes around the world. PyroCMS › The CMS built for everyone. pyrocms is a modern cms built on laravel 5.1 that's built for developers, designers and users alike.

Port Codeigniter App to PyroCMS

I'm working on a web application in Codeigniter. I'd like to integrate the functionality of my application with a CMS so that site admins can easily update the site (about pages, blog, etc). Is this easily done with PyroCMS or another Codeigniter-based CMS? Will I need to drastically restructure my existing app?


Source: (StackOverflow)

Making a blog the home page in PyroCMS

I know that I can go into pages and make an individual page the default home page, but how do I make a blog the home page in PyroCMS?


Source: (StackOverflow)

Advertisements

Which CMS will be better to load different templates in different pages in CI? [closed]

I am trying to look forward for the CMS in which the designer can easily implement the different templates for different pages so that the site can be completed in short time even without the web developer. Can you suggest the appropriate CMS for that except JOOMLA? Currently I am thinking of using pyrocms. Will pyrocms support the feature?


Source: (StackOverflow)

Conditional SetEnv in .htaccess?

Is it possible to set a SetEnv variable in an .htaccess file differently depending on hostname?

For example, I need my .htaccess file to have the following value:

SetEnv PYRO_ENV production

On production boxes, and...

SetEnv PYRO_ENV stage

On staging boxes. The .htaccess file is version controlled, which is the reason I'm looking for a conditional solution.


Source: (StackOverflow)

PyroCMS helper documentation

I'm working on a PyroCMS project, but having problems due to the lack of complete documentation. Does anyone know where I can find a list of core helpers, such as {pyro:navigation:links}?


Source: (StackOverflow)

Problem sending email with Codeigniter - Headers sent in the message body

Having a strange issue with the email class in codeigniter. When I send email directly to my gmail account email address, it works fine. However if I send email to a different email address and use POP3 to import that email address into gmail, then for some reason all the headers are included in the message.

Here's the code for sending the email:

$this->email->clear();
$config['mailtype'] = "html";
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('email@example.com', 'Website');
$this->email->to('accountthatimportstogmail@url.com');
$this->email->message($message);

Here's what arrives in my inbox when the email is sent to an account which is imported into gmail via POP3:

Date: Fri, 7 Jan 2011 15:07:04 +0000

From: "Website" <email@example.com>
Reply-To: "email@example.com" <email@example.com>
X-Sender: email@example.com

X-Mailer: CodeIgniter

X-Priority: 3 (Normal)

Message-ID: <4d272c1835479@example.com>

Mime-Version: 1.0

Content-Type: multipart/alternative; boundary="B_ALT_4d272c1835c46"




This is a multi-part message in MIME format.

Your email application may not support this format.



--B_ALT_4d272c1835c46

Content-Type: text/plain; charset=utf-8

Content-Transfer-Encoding: 8bit



this is the email message content





--B_ALT_4d272c1835c46

Content-Type: text/html; charset=utf-8

Content-Transfer-Encoding: quoted-printable

<html>
<body>
       <p>this is the email message content
</p>
</body>
</html>



--B_ALT_4d272c1835c46--

Source: (StackOverflow)

Convert a PHP date format to a jQueryUI Datepicker date format

[EDIT] : I guess people had problem to understand exactly what I mean, so I completely rewrote my explanations.

I work on a project where users can define a date format used in the whole site. It uses PHP date format standard. For example : "year-month-day" is set by "Y-m-d".

PHP standard uses single-character symbols like Y, m, d, F, j to describe the date format. As seen in the documentation : http://www.php.net/manual/fr/function.date.php

Sometimes users can select a date thanks to a jQueryUI Datepicker. This component describes its date format with code-words like yy, y, mm, dd, D, ... http://api.jqueryui.com/datepicker/#utility-formatDate

I would like to display the dates in the same format for both PHP and the Datepicker. I mean that PHP should output the date as in the format set by user, AND the Datepicker should show the selected date in the same format.

Given that:

  1. The date format is necessarily described "PHP style"
  2. I can't know a priori which format was set by users

/!\ This not a problem of how to read/parse/display a date from a known format.

Unfortunately, Javascript date format description is not the same as in PHP. For instance, these 2 date formats are equivalent but described differently in PHP and Javascript:

  1. PHP : Y-m-d (set by users)
  2. Javascript : yy-mm-dd

As you can see, I cannot just configure the datepicker with the PHP date format, because it will be misunderstood, or not recognized at all.

Someone (in answers below) adviced to create my own "date format standard converter", matching each PHP symbol with its equivalent in JS date format description. Just like:

  • Y => yy
  • m => mm
  • d => dd
  • y => y
  • z => o
  • ...

And then replace each PHP symbol with the JS one. And so "d/m/Y" will be translated into "dd/mm/yy", magically.

But maybe somebody knows another proper way to make jQueryUI Datepicker understand PHP date format standard?

EDIT: I wrote a tutorial that explains both the problem and the solution. For further reading : http://tristan-jahier.fr/blog/2013/08/convertir-un-format-de-date-php-en-format-de-date-jqueryui-datepicker


Source: (StackOverflow)

can't add git submodule to repository

(Predominantly a Git question, but may be relevant to other PyroCMS users)

I have a local repository of PyroCMS - the repo is a clone of a github fork of the main project. I also have a PyroCMS module, which is also a local clone of a github fork of that project.

I've put them both in separate directories.

~/Dropbox/websites/pyrocmscommunity-test/
~/Dropbox/github/PyroDatabase/

I want to add PyroDatabase as a submodule of pyrocmscommunity-test, so I can pull updates from github, keep track of my own changes etc.

I tried to do this by going to the top of the working tree and doing:

git submodule add ../../github/PyroDatabase/ addons/shared_addons/modules/

but it didn't complete properly:

Cloning into 'addons/shared_addons/modules/database'...
ssh_exchange_identification: Connection closed by remote host
fatal: The remote end hung up unexpectedly

I don't understand this as I didn't specify an SSH connection, I just wanted to use the local repo. What is it trying to connect to and why?

Also, now, whenever I repeat the command, I get this:

'addons/shared_addons/modules' already exists in the index

But I don't understand this as there is no .gitmodules file and no mention of the modules files in .gitconfig either.

What am I doing wrong and how do I reset things?

Thanks, William


Source: (StackOverflow)

How to get Currently logged user's ID in pyrocms?

now i have a project with pyrocms, i have a problem to get the current id user in module's controller, does anyone know how to get it?

thanks , mahathir


Source: (StackOverflow)

Manage Login Redirection in Pyrocms

I need to manage login in such a way that it should redirect the control after successful login to the page which call login method in pyrocms.

By default it return control to Home Page. for example i want to go gallery page but it require user to be logged in so it will redirect control to the login page and now i want to redirect the control back to the gallery page once the user successful logged in.


Source: (StackOverflow)

How do I write an 'if' statement with PyroCMS Lex tags?

Here is my 'if' statement in a loop. Sometimes the description will exist and sometimes it will not. But all I am getting is the word LIKE and not ME when the description actually exists.

{{ description }}
{{ if description }}
    ME
{{ endif }}
LIKE

Source: (StackOverflow)

Action you have requested is not allowed error

I made a module named Gallery which works fine on my localhost with version 2.0.3, but when using version 2.1.0 on a remote site I can not submit a form and I get the error:

The action you have requested is not allowed.

Why is this?


Source: (StackOverflow)

Jquery manipulate urls

I am using pyrocms and all nav links are absolute links which won't allow me to make smooth scrolling work on the page.

My smooth scrolling script is

.js

$('.nav a').click(function() {
     $('html, body').animate({
        scrollTop : $($.attr(this, 'href')).offset().top
    }, 500);
    return false;
});

and with pyrocms my links looks like this to divs on the same page

<a rel='nofollow' href="http://www.mysite.com/index.php/#somelink>Link on the same page</a>

Problem with this is my animate won't work with absoulte urls for some reason. Am I missing something simple, or do I need to convert my links to relative (rel='nofollow' href="#somelink") with jquery. Is that a possibility. I only need this to work on my nav links as they are all links on the index.php page.


Source: (StackOverflow)

Third Level Navigation in PyroCMS Navigation bar

I am having some trouble making a third level navigation bar in PyroCMS, I have not two levels working fine but for some reason it won't let me look through the {{ navigation }} array twice.

This is what I currently have:

        {{ navigation:links group="header" }}
            {{ if children }}
            <li class="dropdown">
                <a rel='nofollow' href="{{url}}" class="dropdown-toggle" data-toggle="dropdown">{{ title }} <b class="caret"></b></a>
                <ul class="dropdown-menu">
                {{ children }}
                    {{ if children }}
                        <li class="divider"></li>

                        <li class="nav-header">{{ title }}</li>

                        {{ children }}
                            <li><a rel='nofollow' href="{{url}}">{{ title }}</a></li>
                        {{ /children }}                            

                    {{ else }}
                        <li><a rel='nofollow' href="{{url}}">{{ title }}</a></li>
                    {{ endif }}
                {{ /children }}
                </ul>
            </li>
            {{ else }}
                <li {{ if class == 'current' or class == 'first current' or class == 'last current' }}class="active"{{ endif }} ><a rel='nofollow' href="{{url}}">{{ title }}</a></li>
            {{ endif }}
        {{ /navigation:links }}

I am guessing "children" cannot be looped twice, if so what is the correct way to make this work?

Thanks!


Source: (StackOverflow)

Laravel - Calling Redirect::to() from within view

I'm currently working on a cms which is built on the Laravel 4 framework. I'm trying to build a plugin system, similar to Pyro CMS, where module views can be included in a page view using the Blade template system.

I'm building a contact form plugin that if submitted successfully will redirect the user to a given url, or simply redirect back to the existing page.

The code for my contact form class is:

class Contact {

public static function form($params)
{
    //get params and execute relevant logic here

    $redirect = isset($params['redirect']) ? $params['redirect'] : Request::url();

    $data = Input::all();

    if($data)
    {
        // Run validation and send message here
        return Redirect::to($redirect)
    }

    return View::make('contact_form_view');
}

}

There is a page controller that will display the appropriate page view depending on the route used and the idea is that a user can drop a contact form into any page template and easily customise it by calling the form function from within the template view as shown below

<html>
    <head>
    </head>
    <body>

        {{ Contact::form(array(

            'to' => 'myemail@mydomain.com',
            'view'  => 'contact_form_1',

        )) }}

    </body>
</html>

This all works fine apart from the redirect. When the form is successfully submitted and the message sent the page refreshes and displays the following message in place of the contact form

HTTP/1.0 302 Found Cache-Control: no-cache Date: Tue, 17 Sep 2013 09:14:16 GMT Location: http://localhost:8888/my_initial_route Redirecting to http://localhost:8888/my_new_route.

About 2 seconds later the redirect then takes place and the browser is redirected to whatever route the user provides in the $params array, or to the current page if no redirect is provided, as in the example above.

Any suggestions as to why it is doing this, as well as any solutions, would be great.

Thanks!


EDIT:

Here is a really brief overview of why I have taken the above approach, which might help with understanding the problem:

A requirement of the project is that the developers that will eventually use the cms can create a indefinite amount of pages via the cms control panel by clicking an "Add page" button. The idea is that we aren't writing new page controllers for every new page we want to create. With that I mind I have the following route:

Route::any('{page_slug}/page', array('as' => 'frontend.page', 'uses' => 'FrontendPagesController@display_page'))->where('page_slug',  '[-A-Za-z0-9_-]+');

The display_page function slimmed greatly is:

public function display_page($slug)
{
    $page = PagesModel::getPageBySlug($slug);
    return View::make($page['view_name']);
}

With this users can create a page with the click of a button, give it a name and a slug, and the app can then display that page and the corresponding view -- defined when creating the page -- without having to add any new routes, controllers etc.

The problem arrises in a situation where a user wants to include a contact form with a page. How do we know if they will add a form or not, what fields they will use and what validation it will require? I need a way of being able to add a completely custom contact form into any page without the developer having to touch touch the cms code. My solution to this was the approach given above: the developer drops the tag into the view and passes the function some params, which customise the forms functionality.

The Contact::form() function is kind of like a controller for the form. It gets and returns the view that contains the from html, processes the submission and returns success/errors messages depending on the outcome.

Now I don't necessarily need to use the approach above but I need a way of separating the contact form controller from the page controller and for developers to be able to add a form to any page without touching the cms backend code.

Any ideas on this would be great.


Source: (StackOverflow)