slug

TYPO3: all urls show the start page (How to debug?)

流过昼夜 提交于 2020-06-17 09:09:43
问题 I have an installation with TYPO3 9LTS where all URls show the start page after the last deployment. Our system has a deployment in three steps: dev, test, prod. I have build new features on dev and got it working so I deployed it to the test system (including an update to the latest version 9.5.18 of TYPO3). On the testsystem (which worked nicely before) I can see only the startpage as all URLs (which are calculated correctly) result in showing the startpage. With ext:realurl I cold inspect

wordpress: how to check if the slug contains a specific word?

荒凉一梦 提交于 2020-02-20 08:39:23
问题 I'm trying to use a conditional statement to check if either of two words (blog & news) appear in the slug. If one shows up I will display one menu, if the other then its corresponding menu shows. 回答1: Using PHP: $url = $_SERVER["REQUEST_URI"]; $isItBlog = strpos($url, 'blog'); $isItNews = strpos($url, 'news'); if ($isItBlog!==false) { //url contains 'blog' } if ($isItNews!==false) { //url contains 'news' } http://www.php.net/manual/en/function.strpos.php 回答2: slugContainsBlog = "blog" if

What is the algorithm of Youtube's for generating video slugs?

China☆狼群 提交于 2020-02-06 08:40:32
问题 When we open a video on YouTube, we see that some random characters in the URL such as https://www.youtube.com/watch?v=cpp69ghR1IM . Is there an algorithm for this job or it just creates random string and checks if its in the database or not? Since YouTube has huge amount of videos, wouldn't be so waste of time to check uniqueness of this generated random string? Also, why YouTube doesnt use better slugs which generated by video title? For example: https://www.youtube.com/watch/Some-Dummy

What is the algorithm of Youtube's for generating video slugs?

让人想犯罪 __ 提交于 2020-02-06 08:40:26
问题 When we open a video on YouTube, we see that some random characters in the URL such as https://www.youtube.com/watch?v=cpp69ghR1IM . Is there an algorithm for this job or it just creates random string and checks if its in the database or not? Since YouTube has huge amount of videos, wouldn't be so waste of time to check uniqueness of this generated random string? Also, why YouTube doesnt use better slugs which generated by video title? For example: https://www.youtube.com/watch/Some-Dummy

PHP preg_replace() - Memory Issues. Alternative?

旧街凉风 提交于 2020-01-24 21:25:11
问题 In a site I'm working on, im converting strings to slugs using the answer in this question. It works, but I'm finding there are HUGE memory leak issues. I've done some research and found that this is just currently a bug in PHP. Are there any alternatives to accomplish something like strings to slug? EDIT: There's another interesting angle to this problem. I'm re-developing a scraper that was made using regex (ugh, i know), so I decided to use DOMDocument / XPath as a solution. The

What is the alphanumeric id in a reddit URL?

╄→гoц情女王★ 提交于 2020-01-20 18:40:12
问题 What is the 7n5lu in the reddit URL http://www.reddit.com/r/reddit.com/comments/7n5lu/man_can_fly_if_you_watch_one_video_in_2 ...and how is it generated? Update: @Gerald, I initially thought this is some obfuscation of the id. It is just doing the conversion from integer to a more compact representation. I am thinking, why is this being done? why not use the original integer itself!! >>> to36(4000) '334' >>> to36(4001) '335' 回答1: The reddit source code is available! Here is what I found for

What is the alphanumeric id in a reddit URL?

心已入冬 提交于 2020-01-20 18:40:02
问题 What is the 7n5lu in the reddit URL http://www.reddit.com/r/reddit.com/comments/7n5lu/man_can_fly_if_you_watch_one_video_in_2 ...and how is it generated? Update: @Gerald, I initially thought this is some obfuscation of the id. It is just doing the conversion from integer to a more compact representation. I am thinking, why is this being done? why not use the original integer itself!! >>> to36(4000) '334' >>> to36(4001) '335' 回答1: The reddit source code is available! Here is what I found for

why I got the error “Couldn't find article with id=ni-hao-wo-zhen-de-henhaoma” when using stringex?

眉间皱痕 提交于 2020-01-17 04:45:08
问题 I want to use stringex for more friendly url. Now my steps as follows: (1) In the model called article: acts_as_url :title, :url_attribute => :slug def to_param slug end (2) articles#show: def show debugger show! do |format| format.html # show.html.erb format.json { render json: @article } end end (3) the articles/_article.html.erb includes: <%= link_to(article_url(article)) do %> ... <% end %> and correctly generates html tag, such as: http://localhost:8000/articles/ni-hao-wo-zhen-de

Change wordpress gallery shortcode slug to filename

為{幸葍}努か 提交于 2020-01-17 03:27:05
问题 Is it possible to change the attachment page slug to the referring filename? In short... i use the Gallery Shortcode to build a simple page based gallery. I change the orignal filename (like DSC1223.jpg) during the upload process (to 3b1871561aab.jpg) but it does not appery as slug within the url. It uses only DSC1223. Is there anyway to change ist? Regards, Steve The best way would be to write something like this in my functions.php function twentyten_filter_wp_handle_upload () { $upload =

How to write regular expression to match only numbers, letters and dashes?

梦想的初衷 提交于 2020-01-11 10:46:07
问题 I need an expression that will only accept: numbers normal letters (no special characters) - Spaces are not allowed either. Example: The regular expression should match: this-is-quite-alright It should not match this -is/not,soålright 回答1: You can use: ^[A-Za-z0-9-]*$ This matches strings, possibly empty, that is wholly composed of uppercase/lowercase letters (ASCII A-Z), digits (ASCII 0-9), and a dash. This matches (as seen on rubular.com): this-is-quite-alright and-a-1-and-a-2-and-3-4-5 yep