Search and Find htm source code


(Kbull) #1

I’d like to do a grep search within the cms searching for assets which are using a particular CSS style, is this possible? The CMS search/replace looks like it searches the content not the source code.


(Nic Hubbard) #2

[quote]
I’d like to do a grep search within the cms searching for assets which are using a particular CSS style, is this possible? The CMS search/replace looks like it searches the content not the source code.

[/quote]



The Matrix Search asset, and the admin search only search for things that are indexed such as text.



What css block are you looking for? I always search the code using Dreamweaver.


(Kbull) #3

Basically, I would be searching for styles that have been used from our CSS files, which we may want to rename or remove eg:
class="font-emphaisis" (spelling)

class="clear"



Improving the class names so they're more semantic - so Simple Edit Users, will have a better idea of what each class will do for them.



Your comment regarding dreamweaver, are you saying we can set up a connection to do this type of search with our mySource Matrix instance?


(Greg Sherwood) #4

There is no way to search for content in the HTML source of pages via a backend tool.


You can do a grep over the data/private/assets directory as the content will be stored in a file there. This would at least give you asset IDs. You could also search through a DB table to get the IDs of the WYSIWYG or Raw HTML cells that contain this content. If one of those methods sounds acceptable, we can help you get them going.


(Nic Hubbard) #5

[quote]
Your comment regarding dreamweaver, are you saying we can set up a connection to do this type of search with our mySource Matrix instance?

[/quote]



Sorry, I misunderstood you.



I thought you wanted to look for some CSS that was hard coded into Matrix itself, not something that you added in an asset.


(Kbull) #6

It's been a long time, but the grep feature Greg describes is of interest:

"You can do a grep over the data/private/assets directory as the content will be stored in a file there. This would at least give you asset IDs. You could also search through a DB table to get the IDs of the WYSIWYG or Raw HTML cells that contain this content. If one of those methods sounds acceptable, we can help you get them going."

I'd like to be able to grep for specific string or parts thereof within the source tags <a href> <div> <h2 class="xxxx"> obtain a list of assets that can be manually updated:

 

Our site is extremely large and in some instances we can no longer run a linkcheck report over parts of our sites due them being over 1000+, and this would also be very time consuming.

 

For example a service is being deleted and new service is taking its place, I need to find all URL's pointing to old and replace with the new. Manually updating is fine but finding them all is the trick.

 

Another example is we're about to change our designs and CSS, so I daresay we'll need to find bits and pieces of code that will required fixing all over the place.

 

Attached is a sample of our search code we can use on our old system. If needed I can obtain the script file.

Hoping this may help in your advise. grep-unix.doc (25 KB)


(Amurray) #7

Hi Everyone,

 

With any latest vers of Matrix has anyone had any success pulling out this data?

 

a straight grep of the data/private/assets folder as root for a string to a folder we can write to yields files with no file size as yet:

 

grep -r "xxxxx" > /home/csu-admin/scripts/grepoutput.txt

 

 

If we were to use the other option and search from the DB, does anyone know the table names we can request our DBA's to search from?


(Benjamin Pearson) #8

The grep command is missing an argument: grep -r "xxxxx" /var/www/matrix/data/private/assets > /home/csu-admin/scripts/grepoutput.txt


(Amurray) #9

Aah, Sorry for the late reply, usually I would get a notification!