Jump to content

dragan

Members
  • Posts

    2,007
  • Joined

  • Last visited

  • Days Won

    21

Posts posted by dragan

  1. @Joss

    I forgot the name / URL of the method, but there was some JS library a while back (mainly due to Flash sites), that you could use to deep-link certain sections of your one-page site, with #anchor links. I was never a big fan of that trend, but if you can somehow generate a unique URL for each "page" / section, more power to you. Guess SEO-wise it can help - but to me, it somehow still feels like a "hack".



    you guys are rock!

    Thanks! I'm old, but not quite that old :-)

    • Like 2
  2. I would take a look at things that are already out there, i.e. Mahara + Moodle.

    re: forum integration

    The major headache is syncing CMS to forum users. There are various "bridge" scripts out there, but they're all somewhat problematic. You never know what update X will change. But as long as the forum script is also open-source, a CMS integration is def. doable.

    edit: just stumbled over this http://www.invisionpower.com/support/guides/_/advanced-and-developers/application/application-extension-membersyncphp-r185 - I guess that could be a good start / building block.

  3. If you do a rough calculation (4 msg / second) for one year, you'll end up with over 3 million entries. Although I'm sure PW could handle that fine, I guess you'll be better off with a custom DB-table. otoh, creating PW pages with the excellent API is a breeze. Depending on the whole workflow, I'd consider some type of cronjob for archiving inactive auctions (set a flag in the custom DB, or use a checkbox inputfield in PW). Also, ask yourself what exactly do you need to do with all these messages. Perhaps a bit more background infos about the site functionality would be good.

    • Like 2
  4. I have noticed a strange thing ever since upgrading to or installing 2.3.8.

    Whenever I edit a page and press "save", the page doesn't reload. It just shows a blank screen with the current URL, e.g.

    http://www.mydomain.com/pw/admin/page/edit/?id=1061

    The edits ARE saved - that's not the problem. Just the blank screen.

    I have to manually get back or hit reload / F5 in the browser. I've tried switching from Chrome to Firefox. I've also tried switching to the old admin theme - no luck. Clearing browser cache: same thing.

    To clarify: This happens when editing / creating / saving pages, and e.g. using the batcher module. Editing fields and templates behaves normally.

    Is this a known bug? I noticed this behaviour now in three sites, all running on 2.3.8.

  5. @Xeto:

    Maybe some ready to use modules (with configuration page, useable/ nice templates,...) could make PW even more interesting for Drupal, Joomla and Wordpress users. 

    For example...

    • image resize filter with colorbox integration (show image as thumbnail / custom size image with link to original image inside a colorbox)
    • tags, archive (parts for a "simple" blog module)

    Using custom image-sizes (cropping / resizing) is very well documented and easy.

    Adding a lightbox / fancybox / shadowbox CSS + JS in your header, and adding the necessary rel=[foo] in your templates is easy too.

    Tags / archive / blog functionality: There's an excellent Blog Profile you can install. Also, there's a date archiver module already out there.

  6. Bienvenu au forum icietla :)

    There are probably many workarounds for that scenario. You could create a checkbox inputfield, and check the value in your head or init.php template. If that checkbox is checked, you could do a redirect to the other language.

    if($page->redirectLang == 1) {
        $user->language = "en";
        $session->redirect($page->url);
    } 

    (untested)

    • Like 4
  7. Thanks. I installed it now on a live server, but now I get still no infos at all, and in addition:

    Error: Call to a member function render() on a non-object (line 19 of /home/foo/public_html/site/templates/map.php) 
     

    line 19 = echo $map->render($page, 'map'); // straight from the Module docs / example

    Also, in page edit mode, I still see "Geocode OFF" below the map - or "N/A".

    To add to all these oddities, the address never gets saved. When I re-edit the page, the address is gone.

    PW 2.3.8, Google Chrome, PHP 5.4.12

  8. I've installed this module for the first time locally, on PW 2.3.8 dev.

    The backend looks fine - except a notice at the bottom: Geocode OFF

    Anybody knows why?

    In my map template, I have just this:

    // head:
    <script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?sensor=false'></script>
    
    // body:
    <?php
    echo $page->marker->address . '<hr>'; 	// outputs the address you entered
    echo $page->marker->lat . '<hr>'; 	// outputs the latitude
    echo $page->marker->lng . '<hr>'; 	// outputs the longitude
    
    $map = $modules->get('MarkupGoogleMap');
    echo $map->render($page, 'map');
    ?>
    

    What I actually see in the rendered frontend, is just this:

    <div id='mgmap1' class='MarkupGoogleMap' style='width: 100%; height: 300px;'></div><script type='text/javascript'>if(typeof google === 'undefined' || typeof google.maps === 'undefined') { alert('MarkupGoogleMap Error: Please add the maps.googleapis.com script in your document head.'); } else { var mgmap1 = new MarkupGoogleMap(); mgmap1.setOption('zoom', 18); mgmap1.setOption('mapTypeId', google.maps.MapTypeId.HYBRID); mgmap1.init('mgmap1', 0.000000, 0.000000); mgmap1.addMarker(0.000000, 0.000000, '/path/to/google-map-test/', 'Google Map Test', ''); }</script>
    

    No map is shown, no address or lat/lng are shown either.

    Is it necessary to add your own GM API key somewhere?

    Is it known to simply not work from localhost / 127.0.0.1?

    Or do I have to change the GM JS URL or add parameters? (v3)?

    Thanks in advance for tips and pointers.

  9. OK, so I found the dev $log API already here: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/WireLog.php

    And I found out to use $user = $this->wire('user')->name;

    The 14 useless empty lines were caused by stupidly naming the function the same as the module itself, d'oh.

    The only remaining question now is to list fine-grained infos about the edited fields (mainly text, but file- and edits in image-fields would be useful too - at least new uploads and deletes). I don't need "old content before save" and "new content after save" - just knowing which fields were edited would be awesome.

  10. I'd like to write a simple module: Creating a log that lists page-edits, i.e. which user has edited which page and when. Write each new entry to a new line in a text file in site/assets/logs/edits.txt. Simple enough.

    Following the Helloworld.module example, I came up with this:

    	public function init() {
    
    		// add a hook after the $pages->save, to issue a notice every time a page is saved
    		$this->pages->addHookAfter('save', $this, 'logEdits');
    
    	}
    
    	public function logEdits($event) {
    		$page = $event->arguments[0];
    		$logFile = '/home/foobar/public_html/site/assets/logs/edits.txt';
    		$fh = fopen($logFile, 'a');
    		$now = date("Y.m.d H:i:s");
    		$stringData = "{$page->path}\t{$page->url}\t{$page->title}\t$now\n";
    		fwrite($fh, $stringData);
    		fclose($fh);
    	}
    
    

    It works - somewhat. I'm confused though why I get 15 lines on each page save(). I get 10 empty lines, then

    /de/medienecho/	/de/medienecho/	Medienecho	2013.12.08 15:17:23
    

    then another four empty lines.

    Should I be using something else than $this->pages->addHookAfter('save') ? Does anybody know why I get 14 empty lines instead of just the right one, once? o_O

    Also, if I wanted to 

    a) list the username

    and

    b) list each edited field

    how would I go about that? I saw on the roadmap for 2.4 that a new $log API will be available, but I'm curious if I could write something now already without it. The var $user->name is always empty. How do I access that from inside a module function?

    Sorry, but I'm totally new to writing modules and using hooks...

  11. Not sure I understand. You can simply re-upload a new site/config.php file to the server, from a fresh PW installation, i.e. edit lines 219-223:

    $config->dbHost = 'localhost';
    $config->dbName = 'foo';
    $config->dbUser = 'bar';
    $config->dbPass = 'asdfasdfasdf';
    $config->dbPort = '3306';
    
  12. Is there somebody with experience with the multilanguage fields in modules ?

    I tried to give the language as a GET var and chaging the user object language var, but no success

    I recently wrote a tiny little frontend template script for querying a product catalogue, to get JSON results back (i.e. not a module - have just discovered the module and this forum thread today). It's supposed to feed an iOS app, sooner or later. 
     
    As expected from working with PW, it was all easy and straightforward.
     
    Since my site in querstion is also using multilang features (4 languages, PW 2.3.2 version), I simply query
    german language data via domain.com/de/API/?foo=bar?etc.etc.
    and french data with domain.com/fr/API/?foo=bar?etc.etc.
     
    But it would be relatively easy to output all four languages with the same "web service" URL, if really needed. I guess something like this should be all that's needed:
     
    $user->language = $languages->get("en"); // the following selector query will return english
    $user->language = $languages->get("fr"); // the following selector query will return french
    $user->language = $languages->get("default"); // the following selector query will return default lang.
     
    And if you only want to use ONE service page URL, and decide to just get ONE language back, simply use another GET param (〈=en) and a switch / if-else statement in your code.
    • Like 1
  13. fwiw, you can also just use two input fields (publish_start / end), and keep the pages hidden by default. All you need to do then, is adjust the selector when listing events / pages include=hidden / or include=all. (i.e. not using lazycron).

×
×
  • Create New...