Page 1 of 1

News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 2:11 pm
by michaywood
Hello CMSMSers! I've got a site setup where the customer wanted a different layout for mobile, so I'm using {if false !== $smarty.server.HTTP_USER_AGENT|lower|strpos:'iphone'} to show different elements if it's an iphone or not. However, when pulling up the news module on my iphone, i click the MORE link after the summary, the url changes to the .com/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=2&cntnt01returnid=22 like it should, but the page that is shown is the news homepage! It works perfectly on the computer, just won't load the article on mobile! Any ideas?

Thanks in advance!





----------------------------------------------

Cms Version: 1.10.3

Installed Modules:

CMSMailer: 2.0.2
CMSPrinting: 1.0
FileManager: 1.2.0
MenuManager: 1.7.7
MicroTiny: 1.1.1
ModuleManager: 1.5.3
News: 2.12.3
Search: 1.7
ThemeManager: 1.1.4
CGExtensions: 1.31
FileBackup: 0.5
GBFilePicker: 1.3.2
ListIt2: 1.1
ListItClients: 1.1
MysqlDump: 1.2.4
FormBuilder: 0.7.2
Gallery: 1.5.3
SiteMapMadeSimple: 1.2.6
TinyMCE: 2.9.11

Config Information:

php_memory_limit:
process_whole_template: false
output_compression: false
max_upload_size: 10000000
default_upload_permission: 664
url_rewriting: none
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:

phpversion: 5.2.17
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
memory_limit: 64M
max_execution_time: 30
output_buffering: On
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 10M
upload_max_filesize: 10M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)

Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysql)
Server Db Version: 5.1.66

----------------------------------------------

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 2:26 pm
by calguy1000
a: this is probably a problem with your template.
b: CMSMS 1.10.3 is no longer supported. Sorry for the inconvenience.

Topic locked.

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 4:23 pm
by michaywood
I have no upgraded to 1.11.2 so I am on the latest, supported version of CMSMS.

Merely upgrading to 1.11.2 did not do the trick. Here is what my template looks like:

Code: Select all

</__body>
{if false !== $smarty.server.HTTP_USER_AGENT|lower|strpos:'iphone'}
{literal}
<__script__ type="text/javascript">
		window.addEventListener("load", function() { setTimeout(loaded, 100) }, false);
	
		function loaded() {
			document.getElementById("page_wrapper").style.visibility = "visible";
			window.scrollTo(0, 1); // pan to the bottom, hides the location bar
		}
	</__script>
{/literal}

<div class="mobile_header"> 
<div class="mobile_header_filler">Premium Videography and Photography</div>
<div id="mobile_header_menu">{menu template="Rock the Menu" number_of_levels="1"}</div>
</div>

<div class="mobile_content">{content block="Mobile Content"}</div>

{else}

<div class="regular_header"> 
<div class="regular_header_filler">Premium Videography and Photography</div>
<div id="regular_header_menu">{menu template="Rock the Menu" number_of_levels="1"}</div>
</div>
<div class="regular_content">{content}</div>

{/if}
<br /><br /><p>&nbsp;</p>
  <__body>
Thanks in advance!

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 5:24 pm
by Dr.CSS
This doesn't look like correct smarty logic...

{if false !==
== means equals
!= means not equals

http://www.smarty.net/docsv2/en/languag ... ion.if.tpl

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 5:56 pm
by reneh
Where should your more show the content?
default inline is block "content" and that is not on mobile!

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 6:29 pm
by michaywood
good point! didn't even think about that!

I've been reading through the help pages and can't see how to tell the news module to display in which content block. Any ideas on how to do that?

Or is there a better way to build the page so it defaults to content? Would something like PrettyURLS (if they're supported anymore) allow the MORE link to work correctly without making any changes to the template?

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 6:37 pm
by uniqu3
Well what speaks against using {content} on both?
On top of template

Code: Select all

{content assign='my_content'}
then use {$my_content} in both template parts.
Then to use Mobile content block assign it to

Code: Select all

{content block='mobile_content' label='Mobile Content' assign='my_mobile'}
And where you need module calls leave Mobile Content block blank and check in mobile template part.

Code: Select all

{if !empty($my_mobile)}
    {$my_mobile}
{else}
    {$my_content}
{/if}

Re: News module - MORE link doesn't work on mobile!

Posted: Wed Oct 17, 2012 7:06 pm
by michaywood
awesome idea! That did the trick! I had tried putting {content} in both areas but wouldn't let me, so cool to learn the content assign='' feature. Thanks!

My only worry is once they start throwing images and stuff in their blog posts that it may be that need to have different template layouts for mobile and online. Right now (with just text in the blogs) i can use the same templates and it's all good. Reckon we'll cross that bridge when we get there. haha. May see if I can pretty up the URLS somehow as well.

Thanks!