Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/18/2012 in all areas

  1. Markup Simple Navigation Module While there was a lot of people asking how to make navigation, and there were many examples around already (apeisa, ryan...) I took the chance to sit down 2-3 hours to make a simple navigation module. It has even some options you can control some aspects of the output. Installation: 1. Put this module's folder "MarkupSimpleNavigation" into your /site/modules folder. 2. Go to your module Install page and click "Check for new modules". It will appear under the section Markup. Click "install" button. Done. Technically you don't even need to install it, after the first load call ( $modules->get("MarkupSimpleNavigation") ) it will install automaticly on first request if it isn't already. But it feels better. However, it will not be "autoloaded" by Processwire unless you load it in one of your php templates. Documentation: https://github.com/somatonic/MarkupSimpleNavigation/blob/master/README.md Modules Repository processwire.com mods.pw/u Download on github https://github.com/somatonic/MarkupSimpleNavigation Advanced example with hooks creating a Bootstrap 2.3.2 Multilevel Navbar https://gist.github.com/somatonic/6258081 I use hooks to manipulate certain attributes and classes to li's and anchors. If you understand the concept you can do a lot with this Module.
    1 point
  2. Unless I'm missing something here with oEmbed, you don't need any complicated libraries. Assuming for example the two most common video services you use on a particular site are YouTube and Vimeo, you would simply need to check the URL that has been input into a text field (or URL field or whatever) in PW for either "youtube" or "vimeo" and then use CURL to do either: https://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D-UUx10KOWIE&format=xml or: http://vimeo.com/api/oembed.xml?url=http%3A//vimeo.com/7100569 and parse the XML into something useable in a template. I think that the second and third solutions linked to in previous posts poll those two websites (noembed and autoembed), adding another unnecessary link which relies on those websites being online all the time (I might be wrong). I would imagine that a module for oEmbed would "simply" (haha ) detect which site, if any, the URL relates to, fetch the XML response for that site's video service and turn it into something useable - so a normal module call for this in a template would probably be about 4 lines or so and could also allow you to specify dimensions for the video and then do all of the outputting for you. You could then theoretically just dump YouTube/Vimeo/whatever URL's into the middle of your TinyMCE content if you like and have the module parse the $page->body field, turning these links into embedded videos if you really wanted to. I'm tempted to build this module myself as I've currently only managed to build support for YouTube in my current project (using a lot of Google YouTube API files that now appear to be unnecessary), but it'll be a few weeks before I got around to it so if anyone else wants to have a go at it feel free.
    1 point
  3. I think you're on the right track Antti. The first time I thought about it, back when I was very new to PW, I thought that it should save the relationships both ways. Obviously to de-link the pages this makes it a bit more complicated, plus adds unnecessary clutter to the database (you're saving the relationship twice). Your module idea sounds good and I don't think it would be much more work on top of the "view relationships" to have a button that removes the relationship, so you can do it from either end. Having said "I don't think it would be much more work" I don't have time to look at it myself, but I agree it would be an interesting one to look at for the future. Could even be a useful core addition. I think the only concern I have is to keep it from being confusing for the user, as if they can see page relationships but can't add relationships this might become confusing. Again, you could theoretically add functionality to create more relationships from such a module, but then you're really blurring the lines around which page the data is actually stored against. I like to over-complicate things - maybe just viewing the relationships would be fine
    1 point
  4. Currently there is no such a feature, but I agree that it would be a useful feature to have. It shouldn't be too difficult module to build. Maybe a fieldtype that just shows all relations for that page and where they are defined.
    1 point
  5. If($page->template = Should be: If($page->template ==
    1 point
×
×
  • Create New...