View submitarticle.twig
{# Get the requested entry slug from the URL #} | |
{% set requestedSlug = craft.app.request.segments|last %} | |
{# Fetch the entry with that slug #} | |
{% set entry = craft.entries() | |
.slug(requestedSlug|literal) | |
.anyStatus() | |
.one() %} | |
{% if entry|length %} |
View smarty_modifier_mediaurl.php
<?php | |
function smarty_modifier_mediaurl($value, $format = array()) | |
{ | |
if (is_numeric($value)) { | |
$id = (int)$value; | |
$media = Shopware()->Models()->getRepository('Shopware\Models\Media\Media')->findOneBy(['id' => $id]); | |
if ($media) { | |
$path = $media->getPath(); |
View error.log
shopware [6.1] sudo bin/build-js.sh | |
Password: | |
readlink: illegal option -- f | |
usage: readlink [-n] [file ...] | |
usage: dirname path | |
usage: dirname path | |
npm ERR! code ENOENT | |
npm ERR! syscall open | |
npm ERR! path /vendor/shopware/administration/Resources/package.json | |
npm ERR! errno -2 |
View gist:d82e289e891d1952fe4d0367b772665a
<form class="profile-form" method="post" accept-charset="UTF-8" enctype="multipart/form-data"> | |
{{ actionInput('users/save-user') }} | |
{{ csrfInput() }} | |
{{ hiddenInput('userId', currentUser.id) }} | |
<input type="hidden" name="fields[qualification]" value=""> | |
{% for item in currentUser.qualification %} | |
<input type="hidden" name="fields[qualification][]" value="{{ item.id }}"> | |
{% endfor %} | |
<input type="hidden" name="fields[qualification][new1][enabled]" value="1"> |
View store-hours.twig
<form method="post" accept-charset="UTF-8" enctype="multipart/form-data"> | |
{{ actionInput('users/save-user') }} | |
{{ csrfInput() }} | |
{{ hiddenInput('userId', currentUser.id) }} | |
<div class="grid-x grid-margin-x"> | |
<div | |
class="cell small-12 large-6 weekdays"> | |
{# Show all days with Monday first #} | |
{% set range = currentUser.openingHours.getRange(1, 0) %} | |
{% for day in range %} |
View jquery.sticky-element.js
/** | |
* Sticky plugin to add a class based on the | |
* scroll position. | |
*/ | |
$.plugin('swStickyElement', { | |
defaults: { | |
/** | |
* The css class for the sticky element. | |
* | |
* @property stickyCls |
View promise-take-at-least.js
// Creates a new promise that automatically resolves after some timeout: | |
Promise.delay = function (time) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, time) | |
}) | |
} | |
// Throttle this promise to resolve no faster than the specified time: | |
Promise.prototype.takeAtLeast = function (time) { | |
return new Promise((resolve, reject) => { |
View installc9.sh
#!/bin/bash | |
# Simple script to install Cloud9 on an Ubuntu Server | |
apt-get update && apt-get install build-essential -y | |
apt-get install git -y | |
apt-get install nodejs -y | |
apt-get install npm -y | |
apt-get install python2.7 python-pip -y | |
# cd ~/to/your/directory |
View ajaxform.js
$('#id-form button[type=submit]').click(function(e){ | |
e.preventDefault(); | |
$(this).text('Einen moment...'); | |
var form = jQuery(this).parents("form:first"); | |
var dataString = form.serialize(); | |
var formAction = form.attr('action'); | |
$.ajax({ |
View gist:0da262095d45806dac383560007ccfbe
{ | |
"ace": { | |
.... | |
"custom-types": { | |
"json()": { | |
"tpl": "smarty" | |
} | |
} |
NewerOlder