Jump to content

deltavik

Members
  • Posts

    28
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

deltavik's Achievements

Jr. Member

Jr. Member (3/6)

20

Reputation

  1. Instead of putting your content in body field, create fields for each section in your page template. Then render each section in its own HTML section. <section id="sec-a"> <h2><?php echo $page->title; ?></h2> <?php echo $page->sectionA ?> </section> <section id="sec-b"> <h2><?php echo $page->title; ?></h2> <?php echo $page->sectionB ?> </section> <section id="sec-c"> <h2><?php echo $page->title; ?></h2> <?php echo $page->sectionB ?> </section>
  2. a css framework like bootstrap or foundation can make your life easier with menu-toggle and responsiveness. As far as testing across devices is concerned, safari has built-in support for viewing your site across devices.
  3. dont think you need to secure htaccess. If it were important, PW would've mentioned it. Moreover, at least in wordpress world, there are third-party plugins that need to edit htaccess file.
  4. So I thought of hooking up with hooks. I installed that "hello world" module, and now, when I save a page, I see "Hello world..." message on top -- which makes sense. To play with it further, I copied the hook code from the module to my header.php file. The code is: $pages->addHookAfter('save', $this, 'example1'); function example1($event) { $page = $event->arguments[0]; $this->message("Hello World 2 ! You saved {$page->path}."); } It is a verbatim copy of the code from the module, and it is placed in a file that gets called first via prependTemplateFile in config.php. However, now when I save a page, I don't see the message from my hook function. What could I be missing? thanks,
  5. To lock and protect the file, you will have to modify its permissions on the file system. To do that, you will have to execute "chmod 400 config.php" on command line. There is no "setting" inside config.php. To run that command, you will have to gain ssh access to the server. If ssh is not your thing, you can change file permissions in your FTP client as well -- at least most FTP clients support it. In your FTP client, right-click on config.php and and click on file permissions. Then set the permissions to 400.
  6. Seems like you want Can you give an example of any website that does what you want? That may help us in answering your question.
  7. I am using font awesome in my PW project, and I can confirm that PW doesn't interfere with fontawesome rendering. To troubleshoot, first, try to get your FA icons to work in a plain HTML file outside PW. If that works, then move over fa icon elements into PW files.
  8. since you are this far in troubleshooting, I assume you had also cleared the site/assets/sessions folder?
  9. By any chance, did you add cloudflare or something like that? I ran into this issue recently. The session logs said "Error: Session fingerprint changed (IP address or useragent) (IP: 108.162.219.219)." That IP address is Cloudflare IP. Then, after searching on this forum, I added sessionFingerPrint = false in config.php. The problem then went away. Good. However, the next day I removed that line to test the login/logout issue. Interestingly, I didn't notice any issue. So -- I don't really understand why the problem didn't reappear after I removed that sessionFingerPrint line.
  10. wow. That's a powerful script. I am going to use it. I had been running poor man's backup with these lines as cron. 0 0 * * * mysqldump -uusername -ppassword databasename | gzip > /var/www/backups/sql/sql_$(date +\%m-\%d-\%Y).sql.gz 0 0 * * * cd /var/www/backups/files && zip -r files_$(date +\%m-\%d-\%Y).zip /var/www/docroot/site/assets/files 0 0 * * * find /var/www/backups/sql/ -mtime +7 -delete 0 0 * * * find /var/www/backups/files/ -mtime +7 -delete The first two back up the database and files folder at midnight. The last two remove backups older than a week.
  11. I am on pw 3 and this is the code that works for me. I am new to PW and haven't yet caught up with hooks -- I got this code from somewhere here. <?php $pages->addHookAfter('Page::path', null, 'hookPagePath'); function hookPagePath(HookEvent $e) { $page = $e->object; if($page->get('template') == 'article') $e->return = "/$page->name/"; } This code that updates the urls is the first half of the redirection game. The other half is about redirecting users to the right article. For that, you will have to use urlsegments. Here are the steps, roughly. -- Enable urlsegments for homepage. => This means website.com/this-is-an-article is a hit to the homepage, and this-is-an-article is the first url segment. -- Use this url segment to get a handle to the article page object. ==> $pages->get("name=this-is-an-article") -- Check if its a legit article by checking for the existence of its id. -- If it's a valid page, redirect the visitor to it. echo $article->render(); return;
  12. Just dropped by to say that I have the same setup on my laptop (MAMP + php7 + PW3), and I was able to migrate the site to live (lamp + php7) without any hassles. In my view, PW version is not the reason. One suggestion I have to troubleshoot this situation: -- Load the default, out of the box PW3 on your hosting. -- If that works, then gradually add modules and import templates + fields one at a time until you hit the error.
  13. Yes, something like this was the pseudo code in my head. For this case, I went with sql query straight up. Given the high number of articles and authors, I thought it will be efficient if I just do a private, one-on-one chat with the database. The selector-trick will be useful for smaller datasets.
  14. helpful threads. Seems like many people have run into this situation. I thought I missed something in the tutorials.
  15. thanks @Can for the wirecache example. That will come handy. I am thinking of running the sql query directly to get results. This seems quite efficient. And, I will also cache the results of this. This is my query: SELECT count(pages_id), data as author FROM field_authors GROUP BY data ORDER BY count(pages_id) DESC LIMIT 10;
×
×
  • Create New...