Remove Part of URL with Mod_Rewrite? - apache

On my Blog, i have the following urls
http://localhost/listing-category/wordpress-themes/
My CMS (wordpress) enforces categories on custom post types, but i don't want them. I have tried disabling them, but there is no option. So, is there a way to use Mod_Rewrite to remove "listing-category/" from each url when it displays it.
To make it like so:
http://localhost/wordpress-themes/
Help here? How can i achieve this? What is the best way to do this? Is there is any bad effect of doing this hard coding?

Maybe try this plugin?
Let me know if this is what you are looking for.

Related

Multiple (File.java:123) type links per line in console output

I have my own logger that includes part of a stack trace for each logging statement like this:
2015-03-27 23:12:56,582 INFO something something something (Abc.java:123) (Abc.java:201) (Test.java:99)
Eclipse would turn each parenthesis file/line combination into a clickable link. But IDEA only makes the last one clickable.
I can't find an option to turn the other ones into links. If it there is not out-of-the-box option to enable this behavior, is it feasible to easily implement a plug in for it? Perhaps someone knows of an existing plugin? I can imagine that for some languages some people had the need to make it clickable. I'm seeing the ConsoleURL plugin, which could be a starting point.
What's the easiest route to this?
I found an answer to my own question. I found a plugin called "Awesome Console", that's in the included list in IDEA. It automagically made the other file:line combinations clickable.

Autocorrect using Apache LUCENE

I am using apache lucene for a project to do the autocorrect functionality. I need the suggestions to come up only if the spelling is wrong.
In apache Lucene, I can see that suggesions are coming up even if the spelling is typed right and wrong. How can I eliminate suggestions for right entry?
Found it....
there is a function called SpellChecker.exist()

Trimming the leading THE in SQL results on Joomla module Articles Category

I am trying to trim the leading "the" in a query that returns the titles of articles in Joomla, so that results are displayed in alphabetical order and the leading "the", if present, is disregarded. The module responsible for this is the Article Category (which is Joomla core module) and the file I think I should modify is helper.php in modules/mod_articles_category.
I replace the following line:
$articles->setState('list.direction', $params->get('article_ordering_direction',
'ASC'));
With this:
$articles->setState('list.direction', $params->get('article_ordering_direction',
'TRIM(LEADING \'THE \' FROM a.title) ASC'));
However, if I enable the debug mode, the TRIM is not showing. SO I guess, that I need to make the change somewhere else. Sorry but I am not familiar with Joomla so don't really know where this query is coming from. Any pointer is very much appreciated.
Okay, the short answer is no, I don't believe you can modify a query from a module, just like this. I haven't worked with modules, but I have some experience with components, so I would suggest two approaches:
Try to query the database yourself from the module, not by using setState, but building the query yourself.
You can cheat. Since Joomla has already done the heavy lifting for you, you could just manipulate the result object (i.e. $list) rearranging it and stripping off whatever you don't want. I would also suggest that you treat your code as a layout override, that way you'll be able to update your site without overriding the changes you have made.

confusion in using YII CHtml::link and CHtml::image instead of HTML

I have started an application in YII, I want to use proper standards of YII but am just bit curious about the use of its CHTML Class. I think that using CHtml::link() or CHtml::image() instead of normal HTML code <a></a> and <img src... /> will cost more time to application on server side. I tried to look for some reason to use it but yet not success in finding any good resource on why should I use it and how its beneficial then traditional HTML. Like I can use all those methods for defining paths to actions in normal HTML code then why use it
any help or reference for clarification would be appreciated
Thanks
Let's talk about CHtml::link(). Its main advantage is that you can indicate a controller route and send some get variables by simply passing an array as paramater. Lets say you wanna go to the eat() action of your LivingController, with the variable 'meal' and its value being 'hamburgers'. It could simply be done like this:
> CHtml::link(array('LivingController/eat', 'meal'=>'hamburgers'));
If you want to express this using <a></a> only, then I don't need to tell you how much harder it would be. In addition, we should remember that a link generated using CHtml::link() will always work, even if you change the url format. That wouldn't happen with <a></a>: you would have to rewrite the url every time you change the url format.
The advantages of CHtml::image() are less clear, at least to me. Sincerely, I think it's just a matter of encapsulation.

Jade - way to add dynamic includes

I'd like to do something like the following within a jade template.
include page-content/#{view.template}
As this won't work I have ended up with.
-if(view.path==="/")
include ../page_content/home
-else if(view.path==="/login/")
include ../page_content/login
-else if(view.path==="/join/")
include ../page_content/join
-else if(view.path==="/user/")
include ../page_content/user
ad nauseum
I asked TJ whether it was possible, he replied
unfortunately no, they're compile-time includes, which is somewhat necessary for a few technical reasons that I wont get into but we may eventually need to add a dynamic alternative
I'm wondering if anyone has come up with any alternatives, for example using view helpers.
I'm stuck with a big config file to generate the views - and the if-else statements in the template , I know are going to come back and haunt me. :)
If this is possible using another engine, like ejs or mustache, I'd love to know.
Any ideas much appreciated.
Feels like way too much logic in the view to me. Seems like the best way to do this would be through a dynamicHelper or possibly a mixin