Jump to content

Godfrey

Members
  • Posts

    63
  • Joined

  • Last visited

Posts posted by Godfrey

  1. Awesome, I totally want something like this for my campus, or any future campus. I had sort of the same idea, except more visual-location based. Built a prototype with plain HTML, CSS, JS, MySQL. What did you use in combination with Processwire to make this? 

  2. That filter applied to the photos upon hover is intriguing! It makes the photos jump a little bit though. And under "Projects" one the top right photo is a different height than the rest. But love the classy and vintage style! 

  3. Yes that's exactly how it is. I am going through the same phase. Not born with a programmers/coders mind but mad about processwire. It's a hard fight. But lots can be done with only the api of processwire. Stick to that first and in the mean time learn php to it. Works for most designers. And yes thanks to this forum with a lot of helping pro coders things are really good here.

    Heh,  I also often feel like I'm banging my head against a brick wall when I code. But I guess one day you do break through it.  

    Side note: I actually haven't had any success with curly brackets either, until reading this post. I don't know why, just whenever I used them they never worked until trying it again now. So guess you're not the only one! 

    • Like 2
  4. I'm trying to setup a mailing form.

    In my form's action="" attribute, I'm trying to link to my mailing script.

    However, every time I hit submit, I keep getting redirected to mysite.com/site/templates/path_to_script.php and a blank page that says "Link appears to be broken".

    This is what I've tried:

    <form action="<?php echo $config->urls->templates?>mail.php" method="post">
    
    <form action="<?php echo dirname(__FILE__);?>mail.php" method="post">
    <form action="<?php echo dirname(__FILE__).'mail.php'?>" method="post">
     

    And I keep getting similar results. Usually, the first method works when I try to include things such as my javascript or css files, but it's not working for this. What do I need to do? 

  5. Hmm, I keep getting the error: "Call to a member function findRandomTimed(1) on a non-object" ... or "Unable to complete this request due to an error. Error has been logged." 

    Why would something like this or similar not work?

            $sectionpages = $pages->find("template=section"); // returns a PageArray
            $randSection = $sectionpages->findRandomTimed(1); // findRandomTimed(1) returns 1 page. PageArray is a child class of WireArray right? 
            $randFile = $randSection->files->findRandomTimed(1); // supposedly, the page of $randSection should have a field holding multiple files 
     



     

  6. I'm trying to display a random file per day. Strangely, this works on my development server but not my live server. On my live server, I get random files but it's on every page refresh. So I'm thinking something's wrong with mktime(), and maybe in combination with getRandom().

    This is the code I'm using:

    srand(mktime(0,0,0));
            $sectionpages = $pages->find("template=section");
            $randSection = $sectionpages->getRandom(); // get a random "section" page, each has many files
            $randFile = $randSection->files->getRandom(); // get a random file from that random "section" page.
     

    Would this be a problem with my live server, like with unix/linux timestamps? Or would this be a compatibility problem with getRandom, if that makes sense? 

    I also tried using some code from here: http://processwire.com/talk/topic/2081-when-random-is-too-random/
    But I couldn't quite translate the code from working with Pages to files.

    I'm running WAMP as my dev server, and my shared hosting uses LAMP :\ So I'm guessing there might be a problem there?

    How would you guys approach this? 

    As always, many many many thanks for any help!!

     

  7. Hmm, well right now the main reason I wanted to achieve this was
    1) so that the client could easily see and organize what files he had uploaded among the name of files, and
    2) possibly pull the filename (to echo) instead of having to type in a title in the "description" sub-field or a newly created title field. 


    But currently for both I'm just using the simple workarounds of having the files renamed in English (if possible) and typing the original filename in the description sub-field. So I guess right now for time-savings and simplicity sake it may be a bit overkill to go for that method. 

    But if the need comes up I'll PM you or post again. Thanks Ryan!!

    I also guess it's good to have the original filename for SEO friendliness, though I'm not most concerned about that. Would this method you mentioned have the original filename show up in the file's URL?

    e.g.:
    mysite.com/path/to/filename_in_original_language.doc ?

  8. Quick question here:

    Is it possible to upload files (in a files field) with non-english filenames and still retain the original filename?

    I've tried to upload some files with Chinese file names (probably not the greatest idea), but after the upload completes the names simply turn into "1-20", or "doc.doc" etc. 

    Would I have to download a language pack? (although one for Chinese doesn't exist yet)  

  9. I'm not an expert, and probably others will have better ideas than me, but it seems like you could achieve much of this with URL redirection.

    You could simply have http://example-secondsite.com/processwire/ redirect to http://example-first...om/processwire/ .

    Then PW has a user system. You could set up different users and have them access specific things. (I've never used it myself but I'm pretty sure)

    This way, there's only one core, AND you can "share content". 

    I'm not sure if this is the best way, but you could even have different page trees in PW dedicated to the different sites. 

     

    • Like 1
  10. I have a hard time to understand why one need the field labels (in different languages) in the front-end. After all if the it should render the language the user currently is viewing.

    For me, it is because I have a hidden "about" section in my page. I have an about_title and about_description field, but to get to open this hidden "about" section, I have a button labeled "about"/"(about in chinese)". I don't want to have to create whole 'nother field just for "about_button". This is why I wanted to just use the label name for my field, which I already have translated.  I searched and found this thread extremely helpful ^^

    I am so glad that this thread popped up just as I encountered the same problem. You guys are awesome  :lol: 

  11. Going to dig this thread up again with another question:

    Would it be possible to reference fields via Fieldsets? (or something similar since I know right now they don't have much to do with the API)

    For example, in a template you could set up something like
     

    • title
    • about_fieldset_start
    •       title
    •       description
    • about_fieldset_end
    • contact_fieldset_start
    •       title
    •       description
    • contact_fieldset_end

    Then reference the "title" for "about" by: $page->about_fieldset->title?

    I know that currently you can only place one "title" field per template, but it would be helpful if you could place multiple if there were different groups. Because if on a page there were many different disjointed sections (where you can't use repeaters) like "about", "contact", "feedback", etc... right now wouldn't you have to make title field for all of them? e.g. "about_title", "contact_title", "feedback_title"? Or is there a different method I'm missing?  

  12. Hehe, actually thanks for asking this dragan. I just searched "processwire group fields together" and this was the top (and only related) result. I couldn't find a nice official writeup/documentation on the main site, but luckily this thread showed up and diogo provided that link. 

  13. This is probably horrendous code, but why is it that $language->title in the following code block won't display?

    $savedLanguage = $user->language; 
     
       if( $savedLanguage->id == $languages->get("default")->id){
          $user->language = $languages->get("english"); 
      } else {
        $user->language = $languages->get("default");
      }
     
      echo "<li><a href='$page->url'>$language->title: $page->title</a></li>";
      
    $user->language = $savedLanguage;

    This probably isn't the most elegant code, but I wanted to simply switch between two languages. 
    However, if I use the given (default) code below, $language-title is displayed. 
     

    // remember what language is set to
    $savedLanguage = $user->language; 
     
    foreach($languages as $language) {
     
      // if user is already viewing the page in this language, skip it
      if($language->id == $savedLanguage->id) continue; 
     
      // if this page isn't viewable (active) for the language, skip it
      if(!$page->viewable($language)) continue;
     
      // set the user's language, so that the $page->url and any other
      // fields we access from it will be reflective of the $language
      $user->language = $language; 
     
      // output a link to this page in the other language
      echo "<li><a href='$page->url'>$language->title: $page->title</a></li>";
    }
    // restore the original language setting 
    $user->language = $savedLanguage; 


     

    This seems really weird, because the echo statements are exactly identical. For both, $page->title works. I'm also curious as to how $page->title and $language->title are printed even though they are not escaped from the double quotes in the echo statement...

    Thanks for any help! This is probably a rookie error, I just can't seem to find it... 

  14. Thanks for pointing me in the right direction, dragan! I can't believe I missed multi-language urls. I'm trying it out, and so far yes it is seems to work like magic.

    Though one little thing is (not quite related), should the version # at the bottom of the admin panel should still read "2.3.0" even after upgrading?

  15. Hi everyone,

    I just wanted to get some advice on what's the current best known way(s) and page structuring methods to create a simple dual language site.

    Sorry if this may seem to be a bit repetitive of a topic because of all the past posts on language. But I've been reading a lot of these past posts, and some of them seem they may be outdated as they refer to "coming-soon" methods. I was wondering if there were new features of 2.3 I should be utilizing. 

    For example, a lot of threads point to the localized URL, but now that module says there is a new feature I should rely on LanguageSupportPageNames, though I can't seem to find that in 2.3. 

    Anyway, I'm simply looking to create two versions of the front-facing site. I don't care so much about creating two different language versions for the PW administration system, which I think is what some multi-language support modules in PW help with? (ex multi-language and language-alternate fields?)

    So what are some of the methods you guys find works really well? And what are the modules/field-types you would use for each method?

    Not sure if these are good methods, but for example maybe:

    1. Have two versions of each field in each page, one in English and one in the other language. Then, setup a URL system and depending on the URL detected (/en/ or /ch/), output the appropriate field (e.g. body_english).
    2. Have a whole separate tree for the other language. Though I'm not sure how I would have one template be used for both languages, and have the "home" link go to the respective homes pages. 

    Thanks for any input!

    update: I also realized that I can implement method #1 with Language-Alternate Fields. But I'm wondering if I would use javascript to change the user's language ($user->language = ...... ) upon the click of a link, and have that page refresh automatically and display the clicked language. Or how I could insert a URL segment (go from site.com/en/page.php to site.com/ch/page.php) ?

  16. I feel like I've read about this problem somewhere, but not sure where.

    Right now I'm trying to create links using the "link" feature in TinyMCE.
    However, when I click those links, it just appends the link's URL to the current pages URL, so I end up getting a non-existant page.

    For example, if my link is to google.com, the link ends up being:

    mysite.com/page1/google.com

    :\ Anyone have an idea what's up? These links were NOT created prior to migration from local server to live server. I'm trying to create them now.

    Thanks!

     

  17. Though I'm not a professional designer, to me I think design-wise this site is pretty good (just my view from as a general visitor). The photos don't seem too saturated for me, and I get the vintage, classic feel from them. 

    The one issue I catch is that the photos (is the page sliders) load really slow and in staggered stages. I'm not sure why though, as when I check the images they don't seem to be too large of photos. 

×
×
  • Create New...