Maintaining K2 module formatting in IntroText - html

So basically I've installed K2 on a Joomla! based website and I have IntroText turned on for category views. There is a Master category, Master, of which all other categories are subcategories, which is how you have to apply IntroText to multiple categories because K2 is finicky - set all the options you want in the Master category and call them from the subcategories.
My particular problem is with losing HTML formatting in IntroText, so all blog posts would look like a brick of text (red lines denote where a paragraph should start, i.e. the <p> tag):
It should look like the following:
I have tried changing pretty much every setting in the Category View option in the Master category to no avail, as the page the IntroText on is a K2 Category page. I have also tried turning ON HTML formatting (it is off by default) and then excluding the p and br tags from being removed, to no avail.
After some Googling, I couldn't find an answer, but I will admit there were one or two I didn't try (mainly modding the PHP files, I would have tried if the answer actually had some feedback). So, if anyone has any suggestions or ideas, let me know please, I would appreciate it. I can provide more details if needed, but for the time being the site is offline. If you would like some more clarification on the website set up I can oblige, but I believe I've added all relevant K2 details that I could.
EDIT: I have also tried commenting out these lines in /~siteDir~/public_html/modules/mod_articles_category/helper.phpto fix the issue, which also didn't work.
$introtext = str_replace('<p>', ' ', $introtext);
$introtext = str_replace('</p>', ' ', $introtext);
$introtext = strip_tags($introtext, '<a><em><strong>');
EDIT2: I tried to just remove the whole _cleanIntrotext function and the call for it, $item->introtext = self::_cleanIntrotext($item->introtext);, but this also didn't work... which means something somewhere else is stripping the IntroText too?

In order to keep the initial formatting of the introtext inside the K2 content module you need to have your item creation options to using two editors. One for introtext and one for full text. You also need to have a specific amount of words in the introtext. This is imperative as you cannot limit the introtext word number afterwards in the module settings, as by default the word number strips out all html tags to avoid breaking the page code as the Introtext word limit field states: Introtext word limit Leave blank to diasble. If you enable this option, all html tags from the text will be cleaned up to make sure the html structure of the site does not brake.. Which imho is a good thing to leave it as is since you don't always know beforehand which <p> or other tag will be left open. I did this and it worked for me; the module kept all the initial formatting. So in conclusion in order to keep the formatting intact leave the Introtext word limit of the module blank and store separately the introtext and the fulltext when creating articles. If you need more info tell me.
EDIT
The same applies to category listings. As I see in your website you have set a limit to introtext inside your category settings. So you should check which category -parent or child- has the limit set and remove it. Go to Components>K2>Categories Click to edit the category(-ies) that have the limit, it should be in Item view options in category listings>Introtext word limit if you hover over the field title you'll see the same warning tooltip about tag stripping that I mentioned before.
To set your item creation to use two editors go to Componets>K2>Parameters>Advanced>Use one editor window for introtext & fulltext set this to No. That way you'll have two separate editors for your item. However this is not obligatory and if you don't need that you can simply add a Read more break anywhere in your text by clicking the button under the editor.

Related

Deleting same, but different html code across all html documents

I'm just wondering how to delete the same, yet different html code in an html page. Or to be able to do this for multiple pages at once too if that's possible.
What I mean by this is html code that has the same beginning, and same end, but not the same middle content between them compared to other .html pages.
The middle may seem similar, but is actually different across all html documents, such as a slight change in a link from page to page.
Or, the middle's code can be entirely different compared to other documents, diverging.
Is there any tool out there where you can specify delete from <span STYLE= to </span> where the middle content is "font-size: x-small; color: #90c040">example link with the middle content varying between different html pages?
If you could specify the beginning and end code to be deleted, and delete everything that's inbetween it, and do this with a one push button that you can specify the parameters, that saves those parameters so you don't have to enter it every time, that would be great.
Or if it could allow you to do multiple html pages at once selecting them manually, a whole bunch at once , or possibly specify a folder and look for every html page in that folder, and delete the html code if it exists once you do it ( if it doesn't exist, then it moves to the next file. )
Thanks! I'm just wondering. Any help is much appreciated! ^_^~
~Update! I've found a program that works!~
I found a link with the programs, Notepad++, TextCrawler, Search & Replace Master, Ecobyte Replace Text, and InfoRapid Search & Replace. I also found multiple file search and replace.
− Notepad++ didn't allow wildcard * or start/end functions.
− TextCrawler as well as InfoRapid Search & Replace didn't work.
− Search & Replace Master was finicky. It didn't work at first, then it did after re-opening the program.
− Ecobyte Replace Text worked the best. This deleted everything beginning to end that I didn't want across many different .html files. I could specify what I wanted with the 'range function'.
− Multiple file search and replace worked too, but functioned differently. If you're looking to keep the beginning and end code, but not what's in the middle, then this one would work for you.
Examples:
Ecobyte will delete <span STYLE= to middle content inbetween to </span>
Leaving you with none of that code remaining.
Multiple File Search will not delete <span STYLE= & </span> but it will delete all of the middle content inbetween.
This leaves you with <span STYLE= & </span> but no code remains if that was inbetween the beginning and end code you specified.
I hope this helps anyone else looking to delete code with the same beginning and end, but different middle code. Cheers! ^_^~
Picture if anyone needs: html different text replacer

Remove different links from MySQL table

How i could remove different links i have in a MySQL field in many rows? I couldn't find a query for that.
I don't have much experience with MySQL, the ideal solutions would be something that begins with something and ends with something.
Example:
On table 'ads' i have a field called 'description' that has the ad description text. I have links inside the descriptions and i want to remove them all, but those links have different urls from ads to ads. I don't want to delete the text of the link, just the link itself <a class="something" href="http://someurl.com">Link text</a>
Please give a better explanation of your problem and a sample of code.
Although, if i'm right on what you want to achieve, you might need something like this below.
Example:
UPDATE ads SET description=REPLACE(description,'whatYouWantToDelete','')
The above will remove everything in your column that contains the string foo.
UPDATE:
These might be helpful.
Remove HTML tags from record
Removing links from posts in wordpress using query

SQL query to find columns with more than one string "a href" in them

I'm organizing articles in a big database and I face a problem - I need to find all articles with two or more links in them.
Every link is HTML link and has form .... How do I SELECT from article database with all links that a have at least two a href in them?
I was taught how to select one a href but two?...
SELECT * FROM `Articles5` WHERE
content LIKE "%a href%"
How to double this?
Had you tried using your own code but twice?
SELECT * FROM `Articles5` WHERE
content LIKE "%a href%a href%"
At first you can get all Articless WHERE content LIKE "%a href%" and put in temporary table. Then replace this value and find "a href" once more.
P.S For this purpose I advice you to use FullTextSearch

Can I make all links lowercase using MediaWiki and use hyphen instead of underscore as word separator?

Can I make in MediaWiki links lowercase and use hyphen instead of underscore as word separator?
Sort of what WordPress or other wiki CMSes do.
Well there's a way to do this within the main namespace at least so the user edited pages have all-lowercase/dash-separated URLs.
You start by manually enforcing your pages to be all-lower case and dash-separated. The initial problem with this is that your internal links now have to have dashes in them, which eliminates the standard plain-language style of internal links and makes them almost unusable:
For examples of this see [[making-mediawiki-links-lowercase|making mediawiki links lowercase]].
Making a new wikilink is no longer adding a pair of double square brackets; the whole link text has to be rewritten (and optionally renamed with a pipe to be readable).
But there's a way to rewrite just the href on the links. First, make two changes to LocalSettings.php:
$wgCapitalLinks = False; # like mentioned above: make MW not capitalize the page titles
$wgHooks['LinkEnd'][] = "seoUrls"; # add a hook to rewrite the links
function seoUrls($dummy, Title $target, array $options, &$html, array &$attribs, &$ret) {
$attribs = str_replace("_", "-", $attribs);
return True;
}
This rewrites the href of internal links to use dashes and not underscores while leaving the rest of the anchor untouched.
Then use CSS to hide (or modify the template file to remove) the regular title on those pages with user content. The CSS will be something like:
.ns-0.action-view #firstHeading, /* main */
.ns-14.action-view #firstHeading /* categories */
{
display: none
}
You do want to leave the title for pages without any user-defined content, like the editing views and special pages. I found that only namespaces 0 (main) and 14 (categories) need to be hidden.
Lastly, instead of the Mediawiki-supplied title, give the page a title by adding an h1 to the top of the page's content itself.
You probably want to rewrite all URLs with underscores to be dashes as well:
RewriteRule ^([^_]*)_([^_]*_.*) $1-$2 [N]
RewriteRule ^([^_]*)_([^_]*)$ /$1-$2 [L,R=301]
Problems
The non-existent page detection is not entirely accurate, because the pages it's searching for have spaces, not dashes. However, as long as you've eliminated all the old pages that have spaces in the title, this won't be a problem.
Because the initial letter is now case-sensitive, the internal links require renames when they're the first word of the sentence.
The table of contents and the inline edit section links will act differently; they're triggered now on every page due to the h1.
Advantages
You can make the titles anything you want. I like to use category pages to have content, but don't like the title of "Category:Blah".
You can also have the page title use mediawiki-illegal or non-ASCII characters without screwing with the URL.
It is possible to make MediaWiki use dashes instead of underscores to indicate whitespace. wikiHow does it. But it requires a number of edits to the source code, which is usually not advised. Also, there is no guarantee to be without bugs.
It looks like you can adjust the link case setting with this configuration value. I wasn't able to find anything regarding the word separator. Good luck.
To make a page name lowercase, use: Template:Lowercase. Add {{Lowercase}} to any page to change how it is displayed.
Links can be used lowercase anyway - the very first letter of a link can be upper or lower case - it will always link to the correct page.

How can I hide/remove/disable "forums views" in vbulletin?

anyone have an idea how to do this.
i need to get rid of forum views either by hide, delete, disable or any other way.
I assume you mean THREAD views in the text below:
Do a template search for $thread[views], and there should be a template called threadbit. If you want to quickly and easily obscure the views just delete $thread[views] and replace with or asterisks, or whatever you'd like.
If you want to remove the whole <td> it becomes more complicated. First you remove that <td>, and then in FORUMDISPLAY template you have to remove the <td> that contains $vbphrase[views] (do a search for it if you can't find it).
But I believe there may be some issue with removing that entire column, and any of the hardcoded colspan attributes among the templates. If so then you would have to reduce the colspan number by one. I'm not sure about the colspan part, it's been a long time since I edited the FORUMDISPLAY and threadbit templates.
Also, you will need to remove the Views from another location in the threadbit template:
title="<phrase 1="$thread[replycount]" 2="$thread[views]"
This shows up when you hover on top of the Last Post column. Just delete $thread[views] and it will show up blank.
i need 50 points to reply, sorry for keep using answer.
i was thinking of going 1 step futher and swapping the word hidden for a picture?
I used the word hidden just as a test to see if it would work which it does