This Forum has been archived

Visit the new Forums
Forums: Index Community Central Forum "Read More": Force it to use only text?
FANDOM's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

50px-Replacement filing cabinet.svg

Note: This topic has been unedited for 3504 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

On BioShock Wiki we have a lot of articles where the first image on the page is a small portrait icon or rounded circle shape. This looks absolutely terrible in the "Read more" article previews. (example)

I could disable the "Read more" on these pages, but I would prefer a way to force the previews to use the article text instead of the images. Could there be a Java Script way to do this?

Not sure if this will be helpful, but this seems to be Wikia's code for the extension:

A snippet from RelatedPages_Index.php:

<?php if( !$skipRendering ) { ?>
	        <nav class="RelatedPagesModule"<?= !is_null($addAfterSection) ? " data-add-after-section=\"{$addAfterSection}\"" : '' ?>>
	                <h2><?= wfMsgForContent('wikiarelatedpages-heading') ?></h2>
	                <?php foreach($pages as $page) { ?>
	                                <?php if( isset( $page['imgUrl'] ) ) { ?>
	                                <a href="<?= $page['url']; ?>"><img data-src="<?= $page['imgUrl']; ?>" width="200" height="100"></a>
	                                <?php } else { ?>
	                                <div class="articleSnippet"><p><?= $page['text']; ?></p></div>
	                                <?php } ?>
	                                <a href="<?= $page['url']; ?>" class="more"><?= $page['title'] ?></a>
	                <?php } ?>
	<?php } // !skipRendering ?>

~ Gardimuer { ʈalk } 08:51, February 17, 2011 (UTC)

If you were to use JS for that, you'd have to delete whatever isset($page[imgUrl']) is, before the script initializes, which would be difficult to do. Not to mention, I'm pretty sure that's a function that's searching the page for an image url. On top of that, your code is from trac - so it's difficult to tell if that script is a downloaded script that you can modify, or a compiler script for after a page is saved. You're much better off with just removing the feature. I've never really found it to be that useful anyway.  Monchoman45  Talk  Contribs  Skystone  13:30,2/17/2011 
You could always take a screenshot of the page and crop out the start of the text. Then you can place this image before the text and in between <div style="display:none">...</div> tags, so that he image doesn't show on the page, but will be used as the page image. This probably isn't all that efficient though (you'd need to have a fixed intro text or else re-upload it every time). I doubt you can edit the script you posted about since it has php in it, which is executed at server side, before your Javascript (which is run client-side) takes effect. - Tjcool007 (Talk / Contribs) 13:41, February 17, 2011 (UTC)
Community content is available under CC-BY-SA unless otherwise noted.