EyeDentify

Members
  • Content Count

    83
  • Joined

  • Last visited

  • Days Won

    2

EyeDentify last won the day on February 10 2016

EyeDentify had the most liked content!

Community Reputation

76 Excellent

About EyeDentify

  • Rank
    Full Member
  • Birthday 07/15/1979

Profile Information

  • Gender
    Male
  • Location
    Sweden
  • Interests
    Web programming and design. cooking. Movies. Photography and more.

Recent Profile Visitors

1,465 profile views
  1. EyeDentify

    No Worries. Indeed its a fairly new API. You can also check it out in the source code at: https://github.com/processwire/processwire/blob/master/wire/core/FunctionsAPI.php For more details. Hope you find it useful. Cheers.
  2. I as have been a bit confused for some time about how the "Markup Regions" functionality in Processwire worked. But i have know read a bit more and think that i am getting to grips with it. And Markup Regions is going to be huge. To aid me in understanding Markup Regions better i started to read the Source code for the new "Regular" theme in conjunction with the Blog about the markup regions. It helped me a great deal to understand the basics and more fine details of it. A tip is to open both links and use the Source code of the "Regular" theme while reading the blog post. The Source code: https://github.com/processwire/processwire/blob/dev/site-regular/templates/_main.php The Blog post: https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/ I hope this could help others starting out with markup regions. Just take it slow and read it a couple a times and soon you will see the greatness of markup regions. /EyeDentify
  3. EyeDentify

    Support for HTTPS is enabled by default in Processwire. Making SSL work with your hosting is a Certificate issue. Check out the letsencrypt.org website for more info.
  4. EyeDentify

    Hey @ryan I was woundering if you would recommend that one save the Page once, before trying to add files for upload and then save again? I think you mentioned that in some thread? Or is this not necessary anymore?
  5. EyeDentify

    So many options so many choices Thank you.
  6. EyeDentify

    Oh thank you again. Missed that one
  7. EyeDentify

    Thank you @Juergen for this answer. Now i understand what i did wrong. I did not know that i could not test the field itself that i wanted to change visibility on. But your answer explains it well. I Thought i was going crazy there for a minute
  8. Hello There fellow PW gurus. I am trying to make a field show as open only if the field is filled out with at string. for example: "my_styles.css" and stay hidden if the field is empty. The field in question is of type "text" if that helps. And i put in the "show this field only if" css_filename!='' because the field name is "css_filename" But no mather what the field is closed because i have choosen it as "closed" as default. What am i doing wrong? i am running PW 3.0.83 Dev.
  9. Simple example for loading template specific CSS file. This example asumes that you have your CSS file in a directory relative to template root. Like: templates/css/my_template_specific.css Also i use in the template a simple text field to hold the name of the CSS file i want to load. I call this field 'css_file' Use what you feel comfortable with. So in your header section of the DOM notice the "page specific CSS" part? Thats were the magic happens. What happens is that we check to see if the file exists in the CSS dir relative to template root. And if it does we load it. Simple and effective. I load all other CSS that is used all over the site in global_styles.css first. And make sure you load template specific last, because then you can easily override CSS in global. DOM header example: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?PHP echo($page->title); ?></title> <!-- main CSS --> <link rel="stylesheet" href="<?PHP echo($config->urls->templates); ?>css/global_styles.css"> <!-- page specific CSS --> <?PHP /* Use relative path in file_exists() */ if(file_exists('css/' . $page->css_file)) { echo("<link rel=\"stylesheet\" href=\"{$config->urls->templates}css/{$page->css_file}\">"); } ?> </head> <body> Thats my way of doing it. I am sure there is plenty of more ways to do it. This is for the newbies or anyone that wants more options. Good luck with your CSS out there in Cyberspace. Cheers from EyeDentify
  10. EyeDentify

    Oh. Ok i see what you mean. I have tried what you are talking about, but i need to associate the file with a Template, and to remove the file from list of files without a Template that gets shown when you click "new template" in admin. then i have to change every Template manually in the tree for every page. There is no option in admin when you edit a Template to change the Orignal associated file (if any) or associate a new one if no one was chosen when creating the Template without a file. Therefore i needed the code. I don´t see the Automatic association you are talking about. Maybe i misunderstood you. Anyway, i have resolved the issue. i Thank you all for your input.
  11. EyeDentify

    You are talking about the Alternate template file functionality. Then Yes, you can have a file uploaded and it would get used by the template that has a alternate template assigned with the same name as the one you uploaded. But in my case i hade Created a Template without a file in Admin, but later i wanted it to have a file for views, but not an alternate file. So my code fixes this by using a Template that i added with a associated file to go with it.
  12. EyeDentify

    You are absolutly right. I was thinking of this but i forgot at the last minute.
  13. Hello Fellow PW Fans and Gurus. I have run into a problem where i have created a template without a template file associated with it. Now i would like to HAVE a template file associated with it, not an alternate but as the main template file. So i thought, that's easy, I upload the template file and change it in template settings but I only get the Alternate template file setting? Ok so maybe i can change it via the API , so i wrote some code for this. <?PHP function changeTemplate($pages = null, $templates = null) { /* get the pages to change template on */ $logItems = $pages->findMany('template=tmp_log_item'); /* get the template object for our desired template */ $Template = $templates->get('tmp_new_log_item'); foreach($logItems AS $key => $logData) { /* use template object $Template to set template */ $logData->template = $Template; /* save page item */ $logData->save(); } } /* do the magic change */ changeTemplate(); ?> Needless to say, PW was not happy about this, It throw up an error message: Error: Exception: Invalid value sent to Page::setTemplate (in /home/virtual/mydomain/public_html/wire/core/Page.php line 1782) Now from what i understand i gave $logData->template the wrong type of value. So what should the value be to correct this? When I read the docs at: https://processwire.com/api/ref/page/ the value can be "string" or "Template". So i gave it a string and it went haywire. How should I approach this cause I realy dont want to manually change template file on över 50 plus pages Maybe I should use the Template class to create the value that the API wanted, but I am unsure how to use it. Thank you for any info you can give me on this. If you want more info to help me, ask and I will try my best to give it to you. Updated and Solved I solved the problem and have updated the code to reflect this. Essentialy i used the get() method of $templates to get the template object for my template i wanted to use using the template name. I gave the Object to the $logData->template property and all went well. We learn something new every day. One Note: The template file you want to use must have been uploaded and added as a template in the Template section in the Admin for this code to work as expected.
  14. Hello cstevensjr. I Agree that this was very interesting. I ended up using this line at the beginning of my config.php file of my sites before any config options. setlocale(LC_ALL, "sv_SE.utf8", "sv_SE.UTF-8", "en_US.UTF-8", "en_US.utf8", "C.UTF-8", "C.utf8"); That made the error message disappear for me and has not come back. As matjzap explained, this makes PHP try all the locales I designated until it finds one that is installed. Then it will use that first locale that it finds. I would like to again thank everyone in the PW community that helps me understand this problem and solve it. You are the best. /EyeDentify
  15. Matjazp Thank you so much for giving me these answers. And explaining everything why this is. I think i get it now I hope this thread gets pinned by moderators so others can get some use of the info in here. Again, thank you for your efforts. Its greatly appreciated. I know a lot of PW but some things still elude me, and i am looking forward to learning more as time goes on. I love PW and i feel this is the CMF for me.