Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

160 Excellent

1 Follower

About joer80

  • Rank
    Sr. Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Texarkana, TX

Recent Profile Visitors

3,968 profile views
  1. I have a client that wants to make all links on a CKeditor field open in a new window and not have to check the attribute in the checkbox. Is there a way to tell it to default to this?
  2. I have been working on a way to layout the files in my template folder that allows people to have more than one theme per website, and better organize the template files and pages, and this is what I came up with. What do you guys think? Has anyone done anything similar? File Layout: /templates/ _init.php. (includes and variables you want all pages to access. I put setting('theme', 'kick-off-news'); to define the active theme.) default.php (Template files can be told to use this for default behavior, or you can clone its contents for more control. I haven't needed to yet.) What is in the default.php file: <? namespace ProcessWire; //sitewide variables and/or functions. ie. Define setting('theme') as active theme. include('_init.php'); //The default temmplate can use the default HTML for the active theme $templateFilePath = $config->paths->templates . 'themes/' . setting('theme') . '/default.php'; //Render template file for the active theme echo $files->render($templateFilePath); ?> /temlates/themes/ (Holds all theme folders.) /temlates/themes/kick-off-news/ Here is what I am putting in the theme folder: /content/ (This has content subfolders for organization. ie. I did /by-page/ and /by-template/. (folders can be autoloaded from page path and template name.) /includes/ (Used for code that will be included across templates, like navigation.) /css/ /js/ /img/ default.php (You can clone for more control if needed, but I have not need to.) Below is an example of what could be in the /temlates/themes/kick-off-news/default.php file. <? namespace ProcessWire; ?> <!DOCTYPE html> <html lang="en"> <head> <? include('./includes/head.php'); ?> </head> <body> <? include('./includes/topAd.php'); include('./includes/header.php'); include('./includes/navigation.php'); //Use selected homepage if no page path. if($page->path == '/'){ $pagePath = setting('home'); //active homepage path. ie /pages/home/ } else { $pagePath = $page->path; } //Load content file for this page if it exists if(file_exists('./content/by-page' . $pagePath . $page->name . '.php')){ include('./content/by-page' . $pagePath . $page->name . '.php'); } else { //Load content file for this template if it exists if(file_exists('./content/by-template/' . $page->template . '/' . $page->template . '.php')){ include('./content/by-template/' . $page->template . '/' . $page->template . '.php'); } } include('./includes/footer.php'); include('./includes/mobilenav.php'); include('./includes/bottom.php'); ?> </body> </html> The reason why I like to be able to select an active homepage is to be able to make another homepage, and flip back and forth on which one is active as needed. No need to copy any paste data, or upload files to another page after it is approved. I mainly only use one or the other, as far as page or template html goes, but I guess you could use both at the same time with a few changes. The advantage to using using one at a time is you dont need to check for a template content file if there is a page content file. If you want to be able to load both, you probably need to have them set output variables, and after they are both loaded, push the results out. Maybe an array with a priority key and html value and loop through the array after they both load. Was overkill for me though. How I did site Tree to organize and separate the pages from the news articles. I also think there is an advantage to this over sticking all template files in the same folder, as you can put related supporting files in the same group. A news category page sidebar can be in the same folder as the news category template. Or related news layouts are next to their parent file.
  3. So setting it manually with axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; worked! Thanks for all the help guys!
  4. So interestingly enough, my axios post by default has all of the cookies needed for the post to be done by the admin user, but it is not seen as an ajax request, so it will not continue if I force it to be ajax with if(!$config->ajax) return; This is how I am doing it. methods: { processForm: function() { //event const self = this; //so .then can access outside this. axios.post('/post/', { pageID: this.pageID, text_heading: this.text_heading }) .then(function (response) { if(response.data == 'success'){ UIkit.notification({ message: '<span uk-icon="icon: check"></span> Changes saved.', status: 'success', /* primary, warning, danger */ pos: 'bottom-right', timeout: 2500 }); } else { UIkit.notification({ message: '<span uk-icon="icon: warning"></span> ' + response.data, status: 'danger', pos: 'bottom-right', timeout: 2500 }); } }) .catch(function (error) { console.log(error); });
  5. Why is no one suggesting Invision Community? Its the forum software we are on right now.
  6. So i was under the impression the axios post doesnt have the superuser cookie just because I did. Are you saying it would if I did?
  7. I started a proof of concept using vue to do live front end edits to processwire fields and have a question. I successfully bound the text field to the vue variable and used axios to send the post to my processwire page /post/ on save, but how do I secure this post page so others can not post edits to this /posts/ page? Thanks!
  8. If I pass in rich text content with <p> tags into $sanitizer->truncate(), it seems to strip out the p tags even if I pass in the keepFormatTags option. Can anyone else confirm? $s = $sanitizer->truncate($news_story->content, ['type' => 'sentence','maxLength' => 600,'keepFormatTags' => true]); Thanks!
  9. This was very helpful to me! Thank you!
  10. Would you consider adding an insert action to the collection panel? That way people can add children? I love this! Thank you for releasing it!
  11. I added a module for this that hooks on page save. Added an ace css text field for color coded markup and when I save, if that page has a css field, it creates the .css file on the server using a timestamp name. public function init() { $this->pages->addHookBefore('save', $this, 'updateThisPage'); $this->pages->addHookAfter('save', $this, 'makeMergeFiles'); } and something like $myfile = fopen('../assets/css/' . $newAssetFilename . '.css', "w"); fwrite($myfile, $allCSS); fclose($myfile); For some reason if I move a page it doesnt work right. Have to save it to fix, but it hasnt bothered me enough to research it. lol I usually add one to my template page, and the individual page and it finds all pages with this field and merges everything into one file. I do one for js also.
  12. Oh wow! That is really neat. I will keep that in mind. After taking the time to figure it all out, I am wondering now if in my situation it would just be better to keep the tree natural, and make a dashboard that you see by default after login, that groups the pages how I want them to be grouped. lol But this may be handy to keep in the mind in the future if I redo an existing website and dont want to do redirects and need that flexibility.
  • Create New...