Skip to content

Instantly share code, notes, and snippets.

@buchin
Last active December 18, 2015 14:09
Show Gist options
  • Save buchin/5794831 to your computer and use it in GitHub Desktop.
Save buchin/5794831 to your computer and use it in GitHub Desktop.
{% api %}
{% for index, item in api %}
{{ item.link | url_to_hyphen | build_permalink_for 2 }}
{% endfor%}
<?php
function url_to_hyphen ($string) {
$string = str_ireplace(array('http://'), '', $string);
$string = str_ireplace(array('.', '/', '%20'), ' ', $string);
return CoreFilters::hyphenize($string);
}
h2o::addFilter('url_to_hyphen');
@buchin
Copy link
Author

buchin commented Jun 17, 2013

StupidPie

[ASK] lagi nyoba bikin situs agc pdf, utk nangkep link pdfnya pake href="{{ item.link }}" trus skrg mo dibuatin link agc, gmn caranya ya?

contoh link:
http://www.domainku.com/vi_tutorial/warna_warni-pelangi.pdf
maunya jadi agc link: domainku_com-vi_tutorial-warna_warni-pelangi.pdf

atau mungkin dibuatin link agc yg lbh bagus diliat, gmn caranya ya?

saya dah nyoba:
href="{{ item.link | hyphenize }}"
malah nyambung semua, ga ada pembatas - atau _

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment